Re:The danger of the trailing dot in the domain name
by joosters on Saturday March 16, 2013 @06:22AM
(#5385021)
The 400 error is just the web server complaining that there is no web site to deliver to you for that hostname. It isn't complaining about the hostname being invalid, per se.
[ Parent
| on HN ]
Re:The danger of the trailing dot in the domain name
by pilif on Saturday March 16, 2013 @08:33AM
(#5385244)
I thought so too, but then I made a little experiment:
pilif@shion:~$ curl -I -H "Host: example.com" http://198.252.206.16/
HTTP/1.1 404 Not Found
Content-Length: 4129
Date: Sat, 16 Mar 2013 12:28:22 GMT
vs. pilif@shion:~$ curl -I -H "Host: example.com." http://198.252.206.16/
HTTP/1.1 400 Bad Request
Content-Length: 334
Content-Type: text/html; charset=us-ascii
Date: Sat, 16 Mar 2013 12:28:56 GMT
The IP is the one from stackoverflow.com. When querying for a host they are not configured (try any), you will get a 404 plus an explanation page that the selected Q&A community doesn't exist.When you try the same host with a trailing dot, you get a generic IIS error 400.
This is too much of a coincidence and I value it as a strong sign that my hypothesis might be correct. I have no IIS at my disposal to replicate paulbeattie's experiment, but the outcome he described further helps confirming my suspicion (no matter the downvotes he got)
Same experiment works with microsoft.com too:
pilif@shion:~$ curl -I -H "Host: example.com." http://65.55.57.27/
HTTP/1.1 400 Bad Request
Content-Length: 334
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Sat, 16 Mar 2013 12:35:10 GMT
Connection: close
pilif@shion:~$ curl -I -H "Host: example.com" http://65.55.57.27/
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 0
Server: Microsoft-IIS/8.0
(snip)
Re:The danger of the trailing dot in the domain name
by joosters on Saturday March 16, 2013 @09:11AM
(#5385318)
That's odd, I would have thought that '404 Not Found' would be the wrong response to send, although you could argue either way.
I used to develop a web server ages ago (Zeus Web Server), it would try and match the Host: header against all the sites it was configured to server, and if none matched, it would send a 400 error back.
(Incidentally, it would happily strip off the trailing dot from the hostname)