Repository navigation
Commit 420ee5c
fix: keep this package's name and its refusals in the browser console
Two things the browser used to say that the middleware's runtime had no way
to say for it.
The console prefix: every message read `[webpack-dev-server]`, and four
snapshots record exactly that, including `Invalid Host/Origin header` — a line
people search for. Taking the runtime as-is would relabel all of it with a
dependency's name and send anyone with a problem to the wrong repository, so
the name travels with the logging option.
The refusal itself: a client turned away by `allowedHosts` or the origin check
is told why, and the reason is logged in the page. That needs the handshake to
complete, so the upgrade is answered even for a client that will be refused
and `guardHotEndpoint` closes it immediately after saying so — which is what
this server has always done. Owning the `upgrade` listener is still what keeps
a proxied upgrade with whoever it belongs to; `isHotEndpoint` went with the
earlier attempt to refuse before the handshake, which would have made the
reason unreachable.
Verified in a browser: the console carries `[webpack-dev-server]`, and a
client from a disallowed origin receives
`{"action":"error","message":"Invalid Host/Origin header"}` and is closed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA1 parent 136c0ba commit 420ee5c
2 files changed
Lines changed: 31 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2455 | 2455 | | |
2456 | 2456 | | |
2457 | 2457 | | |
2458 | | - | |
2459 | | - | |
2460 | | - | |
2461 | | - | |
2462 | | - | |
2463 | | - | |
2464 | | - | |
2465 | | - | |
2466 | | - | |
2467 | | - | |
2468 | | - | |
2469 | | - | |
2470 | | - | |
2471 | | - | |
2472 | | - | |
2473 | | - | |
2474 | | - | |
2475 | | - | |
2476 | | - | |
2477 | | - | |
2478 | | - | |
2479 | | - | |
2480 | | - | |
2481 | | - | |
2482 | | - | |
2483 | | - | |
2484 | | - | |
2485 | | - | |
2486 | | - | |
2487 | | - | |
2488 | | - | |
2489 | 2458 | | |
2490 | 2459 | | |
2491 | 2460 | | |
| |||
2540 | 2509 | | |
2541 | 2510 | | |
2542 | 2511 | | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
2543 | 2515 | | |
2544 | 2516 | | |
2545 | | - | |
2546 | | - | |
2547 | | - | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
2548 | 2520 | | |
2549 | 2521 | | |
2550 | 2522 | | |
| |||
3197 | 3169 | | |
3198 | 3170 | | |
3199 | 3171 | | |
3200 | | - | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
3201 | 3182 | | |
3202 | 3183 | | |
3203 | 3184 | | |
| |||
3442 | 3423 | | |
3443 | 3424 | | |
3444 | 3425 | | |
3445 | | - | |
3446 | | - | |
3447 | | - | |
3448 | | - | |
3449 | | - | |
3450 | | - | |
3451 | | - | |
3452 | | - | |
3453 | | - | |
3454 | | - | |
3455 | | - | |
3456 | | - | |
3457 | | - | |
3458 | | - | |
3459 | | - | |
3460 | | - | |
3461 | | - | |
3462 | | - | |
3463 | | - | |
3464 | | - | |
3465 | | - | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
3466 | 3434 | | |
3467 | 3435 | | |
3468 | 3436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
229 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
| |||
0 commit comments