server: fix Host header (#20843)
It should include port when it's not default.
This commit is contained in:
parent
f40a80b4f3
commit
81bc4d3ddc
|
|
@ -1181,7 +1181,8 @@ server_http_proxy::server_http_proxy(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (key == "Host" || key == "host") {
|
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 {
|
} else {
|
||||||
req.set_header(key, value);
|
req.set_header(key, value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue