Skip to content

Commit 80d512e

Browse files
committed
Rewrite Host header when proxying to esbuild
1 parent eef9eb1 commit 80d512e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/lib/dev-server.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function isHostAllowed(hostHeader, boundHost) {
3232
}
3333

3434
// When binding to all interfaces, allow any host.
35-
if (boundHost === '0.0.0.0') {
35+
if (boundHost === '0.0.0.0' || boundHost === '::' || boundHost === '::0') {
3636
return true;
3737
}
3838

@@ -90,7 +90,10 @@ export async function startDevServer(buildConfig, options = {}) {
9090
port: esbuildServerPort,
9191
path: req.url,
9292
method: req.method,
93-
headers: req.headers,
93+
headers: {
94+
...req.headers,
95+
host: hostname + ':' + esbuildServerPort,
96+
},
9497
};
9598

9699
// Forward each incoming request to esbuild

0 commit comments

Comments
 (0)