Http error 400 Bad Request on name but IP address works

400hostnamehttp

I have got a Vodafone "EasyBox 904 xDSL" router which has a LAN facing administration interface on http (not https) on port 80. I can access it fine when I use

http://[ip of the router]

For convenience I added an entry into our local DNS server which points to that IP.

Pinging that address confirms that the name lookup works:

ping router.our.domain
PING router.our.domain ([ip of the router]) 56(84) bytes of data.
64 bytes from _gateway ([ip of the router]): icmp_seq=1 ttl=64 time=0.448 ms

(note the "_gateway" in the response, no idea where that comes from)
but when I try to use that name in the web browser, I get an http error 400:

http://router.our.domain

Just to be sure this isn't an artefact of the web browser I used w3m:

400 Bad Request

Your Client sent a query that this server could not understand

Reason: Invalid HOST

The browser is connecting directly, there is no proxy involved.

I guess this has something to do with the router's webserver trying to match the name to a local host name and failing. But that's only a guess. I could not find a setting for a host name in the router configuration.

Any hints on what I could try to find the reason?

Best Answer

Seems like web server in the device doesn't like host field in the HTTP request and supports the connections only by ip address or by some special host name.

The documentation says to connect to addministrative web interface you should use domain name easy.box or ip address 192.168.2.1.

The _gateway in the ping output comes from reverse address lookup (resolve the domain name by ip address) with built-in dns server. You can avoid the reverse lookup with -n option of ping.