📜 ⬆️ ⬇️

Share your local web server on the Internet using localtunnel

Sometimes, when testing web applications, you may need to access them from 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 not always there is such a machine, and 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. It works as a client to a public open source tunnel tunneling service.

Using it is very simple:

localtunnel 8080

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

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

sudo gem install localtunnel

After that, when you first start, you need to specify your public key for authentication:

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

If you do not have ready keys for SSH, you can generate them with the following command:

ssh-keygen -t rsa

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

UPD: The above is true for Unix-systems. On Windows, it can probably work through Cygwin.

Source: https://habr.com/ru/post/104048/

All Articles