2

I have a nodejs server make using websocket. Currently, i can view it in localhost by typing raspberrypi.local:5000. Now I want to portforward it so ppl from other network can view it too. How do i go about doing this ?

Thank you

Carlos Frank
  • 33
  • 1
  • 5

1 Answers1

5

I'm port forwarding on my Raspberry Pi by adding these lines right before the exit line in /etc/rc.local:

# Forward port 80 to 5000 (where our web server is) so the 
# web server can run at normal permissions
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000

This allows me to request on port 80, but have the web server running at port 5000 where it doesn't need elevated privileges to run.

jfriend00
  • 175
  • 8