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

--

--

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store