My friend's baby is in trouble and needs a liver transplant. I'd be so grateful if you could direct donations to him!
Help fund Jun Zachary’s Liver Transplant on GoFundMe
How does it work?
Serveo is an SSH server just for remote port forwarding. When a user connects to Serveo, they get a public URL that anybody can use to connect to their localhost server.
ssh -R 80:localhost:3000 serveo.net
The -R option instructs your SSH client to request port forwarding from the server and proxy requests to the specified host and port (usually localhost). A subdomain of serveo.net will be assigned to forward HTTP traffic.
Request multiple tunnels at once
ssh -R 80:localhost:8888 -R 80:localhost:9999 serveo.net
The target server doesn't have to be on localhost
ssh -R 80:example.com:80 serveo.net
Request a particular subdomain
The subdomain is chosen deterministically based on your IP address, the provided SSH username, and subdomain availability, so you'll often get the same subdomain between restarts. You can also request a particular subdomain (from a set list):
ssh -R incubo:80:localhost:8888 serveo.net
ssh -R incubo.serveo.net:80:localhost:8888 serveo.net
Change the SSH username to get assigned a different subdomain:
ssh -R 80:localhost:8888 email@example.com
ssh -R 80:localhost:8888 -l foo serveo.net
If you request a port other than 80, raw TCP traffic will be forwarded. (In this case, there's no way to route connections based on hostname, and the host, if specifed, will be ignored.)
ssh -R 1492:localhost:1492 serveo.net
If port 0 is requested, a random TCP port will be forwarded:
ssh -R 0:localhost:1492 serveo.net
Connect on port 443
In some environments, outbound port 22 connections are blocked. For this reason, you can also connect on port 443.
ssh -p 443 -R 80:localhost:8888 serveo.net
Use autossh for more persistent tunnels.
Pressing g will start a GUI session. Use up and down arrow keys to inspect requests/responses, and left and right arrow keys to switch between request and response views. Use j, k, u, d, p, and n to scroll the lower inspector pane. Press r to replay the selected request. Press h or ? at any time for help.
Serveo is an excellent alternative to ngrok. Serveo was inspired by ngrok and attempts to serve many of the same purposes. The primary advantage of Serveo over ngrok is the use of your existing SSH client, so there's no client application to install.
Other slight advantages include preservation of URLs across reconnect for free (ngrok allows this only for paid accounts) and in-terminal request inspection and replay (ngrok uses a web interface).
Using Serveo instead of OpenSSH frees you from having to configure and maintain a server. It also handles HTTPS and subdomain generation, two features that complicate a typical SSH port-forwarding setup.
If Serveo doesn't meet your needs, this guide has some ideas for setting up OpenSSH.