$http_host and $host not behaving as described
yanghatespam at gmail.com
Fri Aug 13 02:40:38 MSD 2010
This variable is equal to line Host in the header of request or name
of the server processing the request if the Host header is not
This variable may have a different value from $http_host when the Host
input header is absent or has an empty value.
The value of the HTTP header HEADER when converted to lowercase and
with 'dashes' converted to 'underscores', e.g. $http_user_agent,
When I log $host and $http_host, I see different things, yet the Host
HTTP header is set and non-empty.
I'm running an HTTP server on port 80 and I'm logging:
log_format dummy '$host $http_host';
When I browse to http://localhost:8989/ where I have a proxy
forwarding 8989 to 80 (e.g. 2 nc's piped together, socat, or ssh
tunneling), I see this in the log:
$ tail -f /tmp/dummy
Yet if I intercept the HTTP request headers, I see:
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US)
AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4
Host is set and non-empty. Anybody know what's going on? Does the wiki
need to be updated? I'm using nginx 0.7.65 (from Jeff Waugh's PPA).
Thanks in advance.
More information about the nginx