IIS 5 & IIS 6
Getting 400 error if try to access website by IP address
Last post Feb 20, 2009 02:08 PM by Rovastar
Feb 18, 2009 05:42 PM|aiqbal07|LINK
I have 2 Web servers behind Load balancer and am able to get to website by URL without any issue but when I try to go to individual server via IP address, I get HTTP/1.1 400 Bad Request. Using Network traces I can also see the request is made successfully
and server is responding with Bad Request. I have multiple Websites setup on the same server using different IP addresses. Any Help in figuring out what is going is appreciated.
After researching, onlything I found was MS article that suggest that there might be corrupted request but than using URL, same request is successful.
Feb 18, 2009 07:06 PM|Rovastar|LINK
You will get more information about the 400 error in IIS from teh httpsys log files. What do they say?
Have a look at these 400 troubleshooting guides
Feb 19, 2009 04:43 AM|Paul Lynch|LINK
What is probably happening is that you have got all your sites configured to use only their host header names and there isn't a site configured to listen on All Unassigned IP addresses without a host header configured.
In this scenario the HTTP.sys listener can't route the incoming request because it doesn't know where to route it to, so it responds with a 400 Bad Request. If you look in your httperr.log file (you'll find it in C:\WINDOWS\system32\LogFiles\HTTPERR) you
should see a reason code of 'Hostname' there.
If you configure one of your web sites to listen on all unassigned IP addresses with an additional blank host header (in addition to its existing one) you should find that all requests to the server's IP address go to that web site.
Feb 19, 2009 09:31 AM|aiqbal07|LINK
Following your direction, I saw 'Hotname' recorded there and followed the instruction and am able to get to that site using IP, I still need to test it though to figure out if there is any impact to other sites on the server. Thx for your help.
Feb 20, 2009 04:41 AM|Paul Lynch|LINK
I wasn't recommending that as a fix, I was just explaining the behaviour of IIS under those circumstances. I would ask the question why is it necessary to connect to your server via its IP address if your web sites are configured to use host headers ?
Feb 20, 2009 11:31 AM|aiqbal07|LINK
Understood and reason is that sometime I want to test individual server bypassing load balancer to see if the changes I made are going to work or not. As I mentioned in my original post that I have 2 sites setup exactly same way, bound to different IPs.
I can access one web site with its IP, no issue but the other one I can not. I see one difference here is that the site that responds to IP is using the physicall IP of the server while the site that does not response to IP is using additional IP address.
Not sure if that makes any difference?
Feb 20, 2009 02:08 PM|Rovastar|LINK
It is much easier to assign new individual host header names to the site in the farm (eg. myserver1.mysite.com) and add these entries to your IP internal dns/load balancer and you local hosts file. Then you can have multiple sites and it represent teh behaviour
of the servers correctly as it uses host headers.
Maybe you load balancer isn't letting it through to directly connect to the machines. Is IIS returning the 400 error?