Description
Environment
N/A
Reproduction
-
Set up multiple proxies such that Apache HTTP Server is within a chain, for instance the very last proxy before h3:
User Agent -> Proxy (any, proxy1.tld) -> Apache httpd (proxy2.tld) -> h3
-
in h3 app, use
getRequestHost({ xForwardedHost: true })
-
Returns
proxy1.tld, proxy2.tld
Describe the bug
Some proxies (eg. Apache HTTP Server) append additional hosts to X-Forwarded-Host
header when it is part of a multiple proxy chain.
This obscure behavior is thoroughly explained in RicoSuter/NSwag#2370. Due to the non standard nature of the X-Forwarded-Host
header, there isn't any authoritative literature to link to, but Envoy proxy documentation corroborates that the hosts should be appended.
In such cases only the first host similarly to X-Forwarded-For
header should be returned by the getRequestHost
function instead.
Additional context
No response