Share your local web server on the Internet with localtunnel

Original author: Vladimir Grichina
  • Transfer
Sometimes, when testing web applications, you may need to access them from the outside (that is, from the public Internet). For example, some APIs use callbacks.

In this case, you can create a reverse SSH tunnel to share your local server. But for this you need access to a publicly accessible machine with SSH and the necessary ports open on the firewall.

But such a machine is not always found, and it’s broke to buy a VPS or something like that. In this case, localtunnel is just what you need.

localtunnel is a tool specifically designed to temporarily share a local web server on the Internet. He works as a client for open source reverse tunneling public service.

Using it is very simple:

localtunnel 8080

This command will make the local service on port 8080 available on port 80 on the domain that the utility will output.

Of course, before use, you still need to install and configure the program.
Installation for all users:

sudo gem install localtunnel

After this, at the first start, you need to specify your public key for authentication:

localtunnel -k ~/.ssh/id_rsa.pub 8080

If you do not have ready-made keys for SSH, you can generate them with this command:

ssh-keygen -t rsa

More information (in English) and source codes on Github .

UPD: The above applies to Unix systems. On Windows, it can probably work through Cygwin.

Also popular now: