1
I have a HTTP server running on port 9876.
I put http://127.0.0.1:9876/
into Chrome and the page loads instantly.
I put http://localhost:9876/
into Chrome and the page never loads.
I have never modified C:\Windows\System32\drivers\etc\hosts.
Every line in the hosts file is commented out.
The following lines exist in the file and may be relevant:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
As I said, I have not added these lines myself. I have not edited the hosts file.
Obviously I can uncomment the second line to make localhost work. But why is this necessary if the first line is correct? Did Microsoft write the first line? It looks like they're telling me that localhost will work without being defined.
Is your HTTP server also listening on
::1
or just IPv4? – jscott – 2014-02-06T15:33:32.2431Just ipv4 . . . – cja – 2014-02-06T15:33:57.860
uncomment it, and you got your
localhost
back) – alexus – 2014-02-06T15:52:21.360The first line assumes you're running DNS on your box, and that localhost would resolve to your local IP. – Steve Butler – 2014-02-06T15:53:27.010
@SteveButler Ok, put that in an answer and I'll accept it. Also, can you explain why MS decided to disable localhost by default? – cja – 2014-02-06T16:04:29.457
why did I lose 2 points for this question 7 hours today? – cja – 2014-02-07T12:26:42.870