Exposing Localhost to Internet
During the afternoon, I engaged in a random study session on SSH tunneling and the diverse methods employed to establish tunnels between a remote server and the localhost.
While browsing through utilities used for reverse port forwarding I came across this free service serveo which allows users to expose local server to the internet.
Serveo is an SSH server just for remote port forwarding. The service requires no installations or signups. It is run by donations & can be self hosted too.
Exposing the App
Here is how I can expose an app running on local server to internet using Serveo. I have an app IT-Tools running on localhost port 8080.
To expose the app I have to run:
ssh -R 80:localhost:8080 serveo.net
ssh: well known remoting utility.
R: flag for enabling reverse tunneling
80: remote port of the serveo.net on which it listens
localhost:8080: local server with port no to be tunneled
serveo.net: remote server
The command exposes the app to the Internet and returns a random serveo.net subdomain, which is used to access the app running on the local server. Now, if I copy and paste the URL into a browser, the app is HTTPS enabled and accessible to anyone (as long as I have a session running).
Request a particular subdomain
The subdomains are generated randomly based on availability but you can also request specific subdomain with the following command:
ssh -R tools:80:localhost:8080 serveo.net
The URL returned will be tools.serveo.net this time.
Terminate the session
To terminate the tunneling session stop the process with Ctrl + C in terminal. That is it.
If you found this post useful consider sharing it with friends & subscribe for regular posts using RSS or Telegram.
Reply via mail