how do I get 0.0.0.0 to resolve to localhost when browsing a url that contains 0.0.0.0?

Doing some node development on windows. Node programs like to kick out URLs that look like . 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 . Works fine. But when I add the above line to my hosts file and try to access I get:

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

Node-inspector is a good example:

$ node-inspector info - socket.io started
visit 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.

10

1 Answer

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.

7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like