Search code examples
node.jsexpressfirewallnat

Can't Access Node.JS over internet


I'm trying to access a simple node.js/express application over the internet, but I can't for the life of me figure out why it's not working. I can access it using http://localhost:3000 and http://192.168.x.x:3000 but not using my external IP address.

Port 3000 is open on my router (double checked with port online port checker tools), and I've added a rule in the firewall to allow the port (Windows 10).

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, "0.0.0.0")

netstat seems to suggest that port 3000 is allowed through the firewall, right?

C:\WINDOWS\system32>netstat -n -a

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:3000            0.0.0.0:0              LISTENING

Solution

  • I finally figured out the issue! It has to do with me testing the connection inside of the LAN on a router that doesn't support hairpinning (see point 2 in this stackoverflow answer). Simply accessing the application on a device outside of my LAN does the trick.