When I listen on port 80 with NodeJS v10 all other machines can access the port but the machine itself cannot. This is very strange, and is the same for loopback and the eth0 IP address. However, it can access port 90 on itself just fine as can the other machines on the network.
I've used a simple hello world app to verify that the NodeJS script is not at fault.
This also occurs in NodeJS 12.13.0, so I don't think Node is the problem at all.
iptables -L
says everything is empty with policy ACCEPT.
netstat -tulpn
lists no port 80 except the one I'm testing with.
I found this line in
/etc/rc.local
.iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8080
Problem found!
This answer says why the rule did not show up in
iptables -L
: https://serverfault.com/a/685948/32875.It's could be because if you want to use port 80, you need sudo permissions for open it.