Add small comment on why we're removing the host header before forwarding.

This commit is contained in:
Sander Declerck 2025-11-24 15:25:56 +01:00
parent faae0488c8
commit 0a8dacda24
No known key found for this signature in database

View file

@ -151,6 +151,8 @@ function forwardRequest(req, hostname, res, requestHandler) {
function createProxyRequest(hostname, req, res, requestHandler) {
/** @type {NodeJS.Dict<string | string[]> | undefined} */
let headers = { ...req.headers };
// Remove the host header from the incoming request before forwarding.
// Node's http module sets the correct host header for the target hostname automatically.
if (headers.host) {
delete headers.host;
}