Replacing ngrok with caddy + ssh

So I find to be an amazing service which I like a lot.

The downside is that I get a different sub-domain each time and that I don't have control over the whole thing.

I have googled for alternatives to ngrok and eventually I ended in this reddit and sequentially to this blog post from Jacob Errington.

This would have covered my needs, but I can't be bothered with setting up Letsencrypt and combining with nginx and stuff when I know of Caddy!

Caddy provides a reverse proxy with automatic LetsEncrypt certificates without the need to care more than writing a sime Caddyfile like the following:         # the domain to be served
proxy / localhost:3333  # directive to proxy, and the target for proxying

And that's it!

Now you only need to save that file and make sure you set up caddy as a systemd service and load that file.Usually you will be getting 502's if you are not connected, or you can make sure to start it when you ssh into the box.

I will probably add more information on how to set up caddy to be a systemd service that auto starts and restarts on failure.

© Copyright 2019-2021 by Theocharis Ledakis.