According to http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers, the X-Forwarded-Host can contain more than one value:

Be careful when using these headers on the origin server, since they will contain more than one (comma-separated) value if the original request already contained one of these headers

Can REMOTE_HOST contain more than one value? Or it always be the single value?


That's true for X-Forwarded-Host just because there might be multiple proxies in between the original client and the server. The REMOTE_HOST is just a resolved name of REMOTE_ADDR, or NULL, if the resolution fails (i.e. no PTR exists or DNS is temporarily unavailable or the query times out). It's always a single value.

REMOTE_ADDR is always a single value usually referring to the direct client connecting the server. However, with mod_remoteip you can alter this behaviour to get the originating useragent even where that useragent is behind a load balancer, front end server, or proxy server. That's useful when using load balancers and server side reverse proxies, while X-Forwarded-Host is suitable for client side proxies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.