Skip to main content
Photo of DeepakNess DeepakNess

.localhost domains using Caddy Server

Unproofread notes

Working with a localhost URLs with a port number at the end and with http (not https) isn't very pleasing, so I discovered this trick from this tweet where you can use custom localhost domains with https in your browser, locally.

I then found this tweet by Wes Bos where he explains everything in a quick 1-min video. You can install Caddy by running the following command on macOS (docs for other OS):

brew install caddy

Then create a Caddyfile with the following content:

your-project.localhost {
    reverse_proxy localhost:3000
}

Then run the caddy start and it should start working.

Their docs are very detailed as well, almost everything is mentioned step-by-step there.

Comment via email