I've found some interesting reading on the X-Forwarded-*
headers, including the Reverse Proxy Request Headers section in the Apache documentation, as well as the Wikipedia article on X-Forwarded-For.
I understand that:
X-Forwarded-For
gives the address of the client which connected to the proxyX-Forwarded-Port
gives the port the client connected to on the proxy (e.g.80
or443
)X-Forwarded-Proto
gives the protocol the client used to connect to the proxy (http
orhttps
)X-Forwarded-Host
gives the content of theHost
header the client sent to the proxy.
These all make sense.
However, I still can't figure out a real life use case of X-Forwarded-Host
. I understand the need to repeat the connection on a different port or using a different scheme, but why would a proxy server ever change the Host
header when repeating the request to the target server?