Caddy
Web server and reverse proxy that obtains and renews TLS certificates on its own, configured in a short Caddyfile.
Reviewed by adrian
on
Caddy is a web server and reverse proxy with a built-in ACME client: it gets and renews TLS certificates from Let's Encrypt by itself, so there is no certbot timer to look after. On my VPS it is the only public entry point, in front of the website container and Forgejo.
What matters in practice
- One site block per hostname:
reverse_proxy 127.0.0.1:<port>for an app,redir https://example.com{uri} permanentfor a second hostname. - Checks:
caddy validate --config /etc/caddy/Caddyfilebefore a reload,caddy fmt --overwritefor formatting warnings. - Install: Caddy is not in Debian's default repositories; the stable channel comes from Cloudsmith.
- Behind Cloudflare: the proxy has to be off (DNS only), or Caddy cannot get its certificate.
Based on
Used in
- A GDPR-Compliant Google Maps Embed An Astro component that loads Google Maps only after consent, stores the decision in localStorage and builds Google and Apple Maps links from coordinates.
- A GDPR-Compliant YouTube Embed An Astro component that loads YouTube only after a click: show once, agree and remember, or just the link. No cookie, no request to Google before consent.
- Astro Client Islands under a Strict CSP Why Astro islands fail silently under script-src 'self', how I allowed the two hydration inlines by sha256 hash, and a deploy check for hash drift.
- Caching Webmention Avatars Locally An Astro helper that downloads webmention avatars during the build, dedupes and sweeps them, so the CSP stays strict and readers never hit the avatar host.
- Caddy as Reverse Proxy with HTTPS and a Canonical Host Caddy in front of a container on a VPS: automatic TLS from Let's Encrypt, www redirected to the bare domain, the app port closed to the outside.
- Forgejo on Debian 13 with Rootless Podman Forgejo as a rootless Podman container under its own user: a Quadlet for systemd, Caddy in front, SSH on port 2222 and the problems I ran into.
- Keeping a Compose Stack Running After a Reboot A systemd unit that starts a Podman compose stack on boot, so a website comes back by itself after the VPS restarts.
- Leaflet and Stadia Maps Behind a Strict CSP Two fixes that made the photo world map work in production: the tile host in img-src and a Referrer-Policy of origin on the tiles.
- My Old Astro Website My old site at adrian-altner.de: Astro with the Node adapter, typed content collections, IndieWeb features and photos as files with JSON sidecars.
- Operating Astro SSR in Production with Podman A short runbook for the Astro container on the VPS: start and stop, health checks, the four-command update, rollback by commit and Caddy checks.
- Security Headers in Caddy A strict Content Security Policy, HSTS and no-referrer in a Caddy site block, checked with Webbkoll, securityheaders.com and the Mozilla Observatory.
- Updating the Website Repository on a VPS A repeatable update flow on the VPS: check the working tree, pull with --ff-only, rebuild with podman-compose, verify, roll back, all in one script.
- Visitor Statistics from the Server Log with Matomo A self-hosted Matomo fed hourly from Caddy's access log: no tracking script, no cookies, masked IP addresses.