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



Today I Learned: Ruby supports anonymous Modules, just as it supports anonymous Classes.

While looking into customizing the returned response from Doorkeepers TokenController I found that Ruby supports anonymous modules. Which is quite handy for duck typing in Ruby.

Here is a quick example of how it works:

Ruby `Module.new` example.