Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Doing some node development on windows. Node programs like to kick out URLs that look like http://0.0.0.0:8080. In Linux (iirc) pasting that url into the browser will be successful. But in Windows, it's a 404. I thought I'd just be able to add:

0.0.0.0 localhost

to my hosts file but that doesn't seem to work. For instance, I have a debugger running on http://localhost:8080/debug?port=5858. Works fine. But when I add the above line to my hosts file and try to access http://0.0.0.0:8080/debug?port=5858 I get:

Error 108 (net::ERR_ADDRESS_INVALID): Unknown error.

Node-inspector is a good example:

$ node-inspector                                                      
   info  - socket.io started                                          
visit http://0.0.0.0:8080/debug?port=5858 to start debugging  

Do I just need to manually edit that IP to be equal to localhost when copy/pasting? Or is this a weird difference between Linux and Windows?

How do I get 0.0.0.0 to be equivalent to localhost when browsing urls in Windows 7? Chrome is my 'default' browser.

share|improve this question
    
refer to rfc1122 for details on your question: tools.ietf.org/html/rfc1122 –  Lorenzo Von Matterhorn Jan 14 '13 at 18:55
1  
"many node programs expect 0.0.0.0 to be equal to 127.0.0.1" ... What? This... I have no words. –  Ignacio Vazquez-Abrams Jan 14 '13 at 18:58
    
also this: serverfault.com/a/78058 –  Lorenzo Von Matterhorn Jan 14 '13 at 18:58
2  
Binding to 0.0.0.0 allows incoming connections from any interface; making it localhost only will break so very much. –  Ignacio Vazquez-Abrams Jan 14 '13 at 19:00
2  
Why not tell node-inspector et alia to bind to 127.0.0.1 instead? –  Ignacio Vazquez-Abrams Jan 14 '13 at 19:03

1 Answer 1

up vote 3 down vote accepted

So, what's happening here is that node is binding to 0.0.0.0 - netspeak for "All interfaces". This includes localhost, any real interfaces you have, and any virtual interfaces you have. It in and of itself generally does not point to an individual interface. (Technically, it points to "This host on this network", but that's ambiguous at best because "this network" is not defined. So 0.0.0.0 is usually understood to point represent the local computer's IP on every network)

Do you need to manually edit that IP when copy/pasting? Yes. If Linux or a specific browser on linux happens to silently correct it to 127.0.0.1... awesome. But as you've found out, that's not a universal thing.

share|improve this answer
    
Blech, I figured the answer was "that's just windows" but was hoping for better. –  jcollum Jan 14 '13 at 20:08
    
http://0.0.0.0:8080/debug?port=5858 converted to http://localhost:8080/debug?port=5858 will work then... –  Fiasco Labs Jan 14 '13 at 20:08
    
It will, but it's a pain to do it everywhere everytime. –  Rob Jan 14 '13 at 20:12
    
FiascoLabs If you read the original question, it does. @jcollum I would actually use that same sentiment towards linux here - It's supporting obscure, ambiguous usecases which only serve to limit interoperability, and I would further blame node.js for not properly cleaning up the URL before printing it out. –  Darth Android Jan 14 '13 at 20:16

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.