Exposing localhost to the Internet
I needed to test some HAProxy and Let’s Encrypt stuff, and it was easiest to just test it on my development machine, so I wanted a way to quickly and easily expose ports 80 and 443 from my laptop. Here’s my brief survey of what I found.
My requirements:
- Hosted by someone else, because I want instant gratification and I only need this for like an hour
- Forwards both port 80 and port 443 through to my local machine
- Free, because I don’t want to sign up for an account and faff about with providing payment information
Given that, my best prospects are:
- ngrok seems to be the most well-known of these services. ngrok has a free plan, but it’s unclear exactly how limiting that would be for me. It seems like you have to download some
ngrok
program to use ngrok. I can’t tell if it’ll forward both port 80 and port 443. I think ngrok has other features that I’m not currently interested in but which other people might like, such as inspecting/replaying HTTP requests. - https://serveo.net/ is hosted and it works with just SSH. However, “This free version is intended for evaluative and personal use and allows no more than 3 total simultaneous tunnels per instance.” (Emphasys in the original.) Instructions explicitly say that it will forward more than one port at a time. This may actually be non-viable since I do want this for business use. Weird that this service isn’t open source, I guess? They have binaries you can download to self-host.
- https://github.com/localtunnel/localtunnel seems to be free. It has a Node.js client you need to install and run.
I did try http://localhost.run/. It works with just SSH. I see no mention of terms of use. I ended up not using it because it only wants to forward port 80, though they seem to provide you with HTTPS on their own. (I need 443 passed in to me.) Defaults to ${your_ssh_user_name}.localhost.run
for the host name.
My requirements excluded the following self-hosted alternatives:
- frp (fast reverse proxy) seems to be cited very often.
- https://github.com/skx/tunneller actually has a server hosted by the author but the project has a note: “There is a public end-point I host, you SHOULD NOT rely upon it. You should configure your own server, and use it.”
- https://github.com/alexellis/inlets
- https://github.com/jpillora/chisel
- https://github.com/txthinking/mr2
I judged these alternatives not worth my time because they didn’t meet my requirements, or because they were confusing, or because they looked like more work than some of the services I had already found:
- https://github.com/antoniomika/sish claims to be, “An open source serveo/ngrok alternative. HTTP(S)/WS(S)/TCP Tunnels to localhost using only SSH.” It looks like maybe it had a server at ssi.sh at some point, but that appears to be down? I can’t tell. You can probably definitely host it yourself.
- https://sshreach.me/ has some kind of “free trial”.
- https://holepunch.io/ has at least two free plans, which is confusing. I think it wants me to download a macOS binary and use that?
- Several people talk about Cloudflare’s Argo Tunnel, but I don’t see any way to use this without signing up for an account or maybe contacting sales, and there’s no free version as far as I can see.