Search code examples
node.jsgruntjsgrunt-contrib-connect

grunt-connect not working when host is 0.0.0.0


I'm trying to externally access my local node.js development server that's created using the grunt-contrib-connect plugin. The server works (locally) when I use localhost or 127.0.0.1 as the hostname parameter. However, when I change the parameter to * or 0.0.0.0 in order to allow external access (as specified in the documentation), I cannot access the server either locally or externally; this is the error I get in Chrome:

The error message in Chrome

I've tried disabling my firewall and I can see packets coming in from my phone on the correct port (which I'm using to attempt to access my local server externally).

Any ideas why it doesn't work to use * or 0.0.0.0 as the hostname?


Solution

  • Figured it out - when I specified * or 0.0.0.0 as the hostname parameter, I was able to connect externally - I just hadn't tried since I wasn't able to access it locally and assumed it wasn't working at all. Changing the address in the browser to localhost:9000 (instead of 0.0.0.0:9000, which it defaults to) when Grunt first opens the page allowed me to access my server locally.