Skip to content
← all writing

18 Nov 2026 · 5 min read · Systems

Reverse proxy using Caddy

A reverse proxy is a single service that sits in front of all the others: one address and one port, many hostnames, routing by name. It is also the only plac…

Reverse proxy using Caddy cover

A reverse proxy is a single service that sits in front of all the others: one address and one port, many hostnames, routing by name. It is also the only place TLS has to be configured. The alternative is remembering a port per app, which works until the second app.

I run a small homelab on one box, which I wrote about in the self-hosting post. For a while every service there had its own port: monitoring on 8090, notes on 8082, passwords on 8083, the dashboard on 3010, the TV on 8096. I could remember four of them.

Then I wanted HTTPS, and the port list turned into a certificate problem list.

I don't use a public domain for any of this, and I don't want to. There is no .com in the Caddyfile. Every name is a .home record in Pi-hole pointing at this box, and the reverse proxy is a LAN-only door. That decision makes the whole thing simpler, and it's the one I'd make again.

The model

Caddy binds 443 and reads the hostname. notes.home goes to 127.0.0.1:8090, dsh.home goes to 127.0.0.1:3080, and so on. The services speak plain HTTP on loopback because they have never met the internet and never will. No web port is forwarded to the box. DNS answers each name with the LAN address, and the door handles the rest. The naming layer underneath is a separate problem, covered in the .home post.

The rule that makes it work is boring. The proxy is the only process that binds a port the LAN can reach. Everything else binds 127.0.0.1. In Podman that means publishing 127.0.0.1:8090:8090, not 8090:8090. If a service publishes on 0.0.0.0, somebody can reach it directly by IP and the door is decoration.

Why Caddy

Because the certificate problem is the annoying part, and Caddy's answer is an internal certificate authority. One global option turns it on for every site:

{
	# Local CA. Import the root once per device.
	local_certs
}

notes.home {
	reverse_proxy 127.0.0.1:3080
}

pi.home {
	reverse_proxy 127.0.0.1:8090
}

photos.home {
	request_body {
		max_size 100MB
	}
	reverse_proxy 127.0.0.1:3008
}

That's the whole pattern. No ACME, no DNS challenge, no public certificate transparency log for the names of my internal services. sudo caddy trust on the host installs the root, and every other device imports the same root certificate.

The chicken-and-egg step is my favourite small thing in the setup: an HTTP page at http://ca.home serves the root certificate. You can't fetch it over HTTPS without trusting it first, so it's plain HTTP on purpose. A phone opens the page, downloads the .crt, trusts it, and then every other .home name works without a warning. The TV was the only device that made me work for it.

The gotchas that actually bit me

Upload limits. Caddy has no default request size limit, so this one is a bonus: the photo app needed an explicit ceiling so a stray upload couldn't fill the disk, and I needed a limit that wasn't "1 MB". The request_body block is the answer.

Streaming and long-lived responses. A reverse proxy buffers by default, which is fine for a page and terrible for a clipboard app or a server-sent events feed. flush_interval -1 on that one route turns buffering off. For slow backends, transport http with a dial_timeout and response_header_timeout stops the proxy from giving up before the app does.

Websockets. Caddy upgrades them without being asked. nginx needs proxy_http_version 1.1 and the two upgrade headers, and forgetting one is a classic afternoon.

Config changes. Edit, then validate before reloading:

caddy validate --config /etc/caddy/Caddyfile
caddy reload --config /etc/caddy/Caddyfile

I keep the previous file beside it and a note saying which is which. A bad reload on the only door is a bad time, especially when your notes app is how you remember how to fix it.

What about nginx and Traefik

nginx is fine. If you've run it for years, the knowledge is worth more than the lines you save, and an internal CA is just a certificate path and a root you import once. Traefik is good when dozens of containers should grow routes from labels; it's less fun when one typo makes a route quietly disappear and the dashboard is the only place that knows why.

I picked Caddy because the config is one file a human can read, the internal CA removed an entire category of work, and I don't need a second dashboard for the proxy.

What this fixes, and what it doesn't

The address bar says notes.home instead of 192.168.100.165:8090, the padlock is real, and nothing left the LAN. That's the whole win.

It does not give me remote access. That's a separate layer: Tailscale for my own devices, and if I ever need a link a family member can open without installing anything, a tunnel with an access policy in front of it. The proxy stays the internal door either way.