Skip to content

Commit 7ac336a

Browse files
committed
Handle Node v20 breaking change that rejects all requests without Host headers
1 parent e769890 commit 7ac336a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/server/http-combo-server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ export async function createComboServer(
184184
server = httpolyglot.createServer(tlsServer, requestListener);
185185
}
186186

187+
// In Node v20, this option was added, rejecting all requests with no host header. While that's good, in
188+
// our case, we want to handle the garbage requests too, so we disable it:
189+
(server as any)._httpServer.requireHostHeader = false;
190+
187191
server.on('connection', (socket: net.Socket | http2.ServerHttp2Stream) => {
188192
socket.__timingInfo = socket.__timingInfo || buildSocketTimingInfo();
189193

0 commit comments

Comments
 (0)