I have my mac mini running a nodejs server on port 8000. On the mac, I can hit it at I get back a "hello world" type of response.

On the same network, from a different machine, I cannot hit this server on the mac. I am getting time outs. I have been pulling my hair out trying to understand why.

  1. I check the machine on the local net. For instance should resolve to that machine and port from another machine. Times out.

  2. I have a NAS admin page sitting at (sorry about that typo before) and it resolves beautifully. Port 5000 is forwarded to the NAS from the router.

  3. I have set up the firewall rules (on the router) in exactly the same way for nodejs as I did for the NAS. The NAS is available outside of my network via a router rule and a no-ip dynamic DNS mapping. The nodejs server is forwarded the same way. No dice, times out.

Any thoughts? I have no firewall (that I can detect) on the mac. I can see the server listening to 8000 on the mac. It works locally.

What am I doing wrong here?

UPDATES with answers to questions.

Thank you all for the feedback, Here are the answers to your questions.

Output from netstat.

netstat -anp tcp | grep 8000

tcp4       0      0  *.8000                 *.*                    LISTEN

I do not have the mac firewall running (at least in the system settings I mean). I have seen posts about something called IPFW, but I have no idea what that is.

On the mac, when I hit I get:

Hello World

My understanding of nodejs is that I just "bind it" to a port. Here is the code, right out of their example.

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');

console.log('Server running at');
  • 2
    I think is a typo. If so, please fix. Also, please edit your question to include the output of netstat -anp tcp | grep 8000 on the host that's running nodejs, which will show the state of listening and active TCP connections on port 8000. – Kyle Jones Mar 12 '12 at 18:17
  • Factor out the router and the network. Try to access the service from the Mac locally using the exact same URL as you try to use with other machines on the LAN. It's possible the service is just bound to and not the LAN IP. – David Schwartz Mar 12 '12 at 20:05
  • Did you open the port on OS X's built-in firewall as well? Also when you started the server, did you set it to listen to as opposed to – billc.cn Mar 12 '12 at 20:31

I have an similar issue.

I found it is not helpful by changing firewall options(even disable firewall entirely) to enable the node access from outside on MAC OS X, at least, not work in my case.

My solution is to change the host name which bound with the node.js server:

  • use '' as host name to allow access from outside
  • use 'localhost' with local access only

I guess 'localhost' used as the default value somehow, and hope this tip is helpful to others.



My machine is currently configured thusly:

  • The firewall is off - I am behind a hardware router that is locked down.
  • All sharing is off in the system prefs.
  • I have a static IP address (network prefs : "using DHCP with manual address").
  • My server is still the same, it is running on port 8000.

I am now able to hit it from inside the LAN and outside with my no-IP domain. I think it was the static addressing thing personally - though I am not 100% sure.

  • is there any luck for you yet? Stuck up with exactly the same issue. – Futur Mar 29 '12 at 13:28

Still I'm not convinced with a proper solution for this but, To make it work i simply did this,

  1. Start your Mac OSX default web server and in the index.html,
  2. Add a redirection code in it which will point to your node js port, and you can access the same from outside LAN systems as well.

Actually,This will not be the scenario when you host it so you can take the above approach and still work on it without a block,

  • I think that a redirect would mean that the node "backend server" is out on the net and every request from a client side service would incur 2 requests to my little mac...I am trying to "shield" it in the context of another server. – JuddGledhill Mar 30 '12 at 18:25

Your Answer

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

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