TIL: How to use Caddy with MacOS for multi project development

--

I keep forgetting the port for various projects running on my machine. Each project gets a port space eg. 31xx or 30xx.

Instead of remembering the ports I now use Caddy to do a reverse proxy. Which is super simple.

# Install Caddy
$ brew install caddy nss

# Edit the Caddyfile
$ vim /opt/homebrew/etc/Caddyfile

And then use Caddy syntax to define the proxies like the snippet below:

myproject.localhost {
tls internal
reverse_proxy localhost:3000
}

Now start Caddy with Homebrew services. Homebrew services will make it run in the background and start it on login.

$ brew services start caddy

--

--

Henrik Hauge Bjørnskov

I build stuff at Relatel A/S, vivid traveller and gear junkie.