2

I'm asking this question specific to nodeJS , but maybe it applies to other web development frameworks as well.

I have a nodeJS Express hello world application running on my laptop listening to port 3000(I'm using Linux Mint Sylvia 18.3).The localhost:3000 and < localIP >:3000 requests to access this app works fine from the same machine and also within the local network of my Router. But when I do a port forwarding on my router to port 3000, and try to access this app via < publicIP >: 3000, it doesn't work.

This is not for any production purposes, but just for learning. How do i make my hello world app accessible over the internet without the help of any 3rd party web server applications (apache/nginx etc) or any local tunnelling (like ngrok)- i.e just like how we access a HelloWorld app from AWS EC2 server by accessing the server < instance >:< port >.

  • 1
    The EC2 example works because it DOES have an externally accessable IP address. If you can configure your firewall, you should be able to get it to passthrough any requests to a specific port to a specific local IP address (not localhost, but your 192.168.X.X address). – Neil Apr 30 '18 at 12:11
  • When you say "it doesn't work" what exactly is it doing? Can you give an error message or some more info? – Nick Larsen Apr 30 '18 at 12:15
  • Thank you Neil. But i am able to access this app from another PC connected to my wifi by mentioning 《 localip 》 : port. So i guess my linux mint firewall is not causing a issue. Am i right? Also i use whatsmyip.com to find my public ip and then try to access the app. Isn't this ip adress a publicly accessible ip? – nullPointerException Apr 30 '18 at 12:17
  • Nick, the server request times out in chrome. – nullPointerException Apr 30 '18 at 12:21

1 Answers1

3

You can make your Node JS or any other application on any port public temporarily by using

  1. Localtunnel
  2. ngrok
Abhishek Singh
  • 2,642
  • 15
  • 24