server: fix Host header (#20843)

It should include port when it's not default.
This commit is contained in:
Evgeny Kurnevsky 2026-03-22 15:29:22 +01:00 committed by GitHub
parent f40a80b4f3
commit 81bc4d3ddc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -1181,7 +1181,8 @@ server_http_proxy::server_http_proxy(
continue;
}
if (key == "Host" || key == "host") {
req.set_header(key, host);
bool is_default_port = (scheme == "https" && port == 443) || (scheme == "http" && port == 80);
req.set_header(key, is_default_port ? host : host + ":" + std::to_string(port));
} else {
req.set_header(key, value);
}