DEV Community

Discussion on: What localhost tunnels have you used?

Collapse
 
jpramod profile image
Pramod Jadhav • Edited

The easiest way, without using any third-party tools is to use a reverse, SSH tunnel.
The pre-requisite

  • Preferably Linux based machine available over the internet
  • ssh access to the machine

Execute the below command to create a reverse tunnel from the remote machine to the localhost

ssh <USER>@<REMOTE_IP> -R <REMOTE_PORT>:<LOCAL_HOST>:<LOCAL_PORT>

All requests from REMOTE_PORT are forwarded : using the created tunnel

To expose hello world http service running on 8080 can be exposed over the internet using

ssh <USER>@<REMOTE_IP> -R <REMOTE_PORT>:localhost:8080

HTTP://REMOTE_IP:REMOTE_PORT/hello...