Find Related products on Amazon

Shop on Amazon

.localhost Domains

Published on: 2025-05-04 18:19:06

I’ve found a way to configure private, custom domains for web-apps I have running on my computer. So instead of having to remember and type “localhost:4333”, I can simply navigate to “appname.localhost”. I love it! Here’s how the system works: Each app is set up as a launchd daemon listening on a unique port. Here’s an example plist. I configure /etc/hosts to redirect traffic to these domains to 127.0.0.1 instead. I then run and configure Caddy to redirect traffic from 127.0.0.1 to the right port for the domain. So, if I’m running an app on port 5050, I will have a corresponding entry in /etc/host: 127.0.0.1 inclouds.localhost and a section in my Caddyfile like this: inclouds.localhost { reverse_proxy localhost:5050 tls internal encode gzip zstd } This is working well but I’d really like to see this process simplified. How cool would it be to install or uninstall apps to .localhost domains with a single command, instead of manually editing three files? Bu ... Read full article.