Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a web page setup in IIS 5. When I navigate to the page using http://localhost/myPageName.html, everything works fine. However when I try to navigate using http://127.0.0.1/myPageName.html or the PCs network IP (say it's http://192.168.0.50/myPageName.html) I get a 404 page not found error.

Note that I get a different error if I try to go to an incorrect IP. So if I fake an ip, say http://333.333.333.333/myPageName.html, I get "Internet Explorer cannot display the webpage".

I've looked through all the IIS settings, but I've had no luck.

Any help would be appreciated.

Thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Have you added that IP to the sites Host Headers?

share|improve this answer
    
This worked. However, I don't understand why I need to setup a Host Header for the computer's IP address. Shouldn't "localhost" RESOLVE to the IP Address? –  Overhed Sep 9 '10 at 17:37
1  
Yes, "localhost" resolves to 127.0.0.1, so your initial connection at the TCP layer will be to 127.0.0.1 on TCP port 80. On top of that, you have the HTTP conversation, which includes the "Host:" header. This will be the "localhost" portion of the URL, regardless what IP address the name resolves to. –  ThatGraemeGuy Sep 9 '10 at 17:56
    
Nope - I'm no webserver expert by any means, but it goes something like this: The serving web site looks at the Host Header your browser sends to it (www.blah.com, or localhost, or MickeyMouse) and determines which website to serve to you (the webserver may host multiple websites). Your machine knows localhost means 10.1.2.3, but the webserver only cares what your browser asked for. You need to tell your webserver what hosts relate to what websites, and which site to serve based on what the users browser requested. –  Izzy Sep 9 '10 at 17:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.