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
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityI 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
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.