Empty host header on http 1.1 results in invalid host header logging in error.log
Bart Warmerdam
bartw at xs4all.nl
Wed Jul 22 04:53:13 UTC 2015
Hello,
Why does nginx logs an info log a message like ...client sent invalid
host header while reading client request headers... request: "GET
/keepalive.html HTTP/1.1", host: ""
if the host header is empty. According to the http 1.1 specification it
is legal to send an empty host header so it should not log this message
since the header is not invalid. So the requests contains the host
header but without a value. The call also results in a 400 instead of a
2xx or 3xx response.
Regards,
B.
curl -v -H "Host: " http://someserver/keepalive.html
* Trying xx.xx.xx.xx...
* Connected to someserver (xx.xx.xx.xx) port 80 (#0)
> GET /keepalive.html HTTP/1.1
> Host:
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Date: Wed, 22 Jul 2015 04:50:51 GMT
< Content-Type: text/html
< Content-Length: 1214
< Connection: close
< ETag: "55ae9a88-4be"
<
More information about the nginx-devel
mailing list