Caddyfile Generator — Reverse Proxy & Static Sites with Caddy

Caddy gets HTTPS certificates automatically — you only describe your site. Choose a reverse proxy (with optional load balancing), a static site, an SPA or PHP, tick redirects, compression, security headers, caching and basic auth, and copy a clean, commented Caddyfile.

Runs in your browserUpdated
Caddyfile

Save as /etc/caddy/Caddyfile, check it with caddy validate --config /etc/caddy/Caddyfile and apply with sudo systemctl reload caddy.

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the Caddyfile Generator

  1. Pick the scenario: reverse proxy to an app (list several upstreams to load-balance), a static site, an SPA or PHP.
  2. Enter your domain and how www should be handled; add an email so Let’s Encrypt can reach you about certificates.
  3. Tick compression, security headers, caching, logging, health checks or basic auth.
  4. Save it as /etc/caddy/Caddyfile, run caddy validate and reload Caddy.

Why the Caddyfile is so short

Caddy turns on HTTPS automatically for any site address that is a real domain: it gets and renews the certificate and redirects HTTP to HTTPS on its own. WebSockets and HTTP/2/3 also work out of the box, so a whole reverse proxy can be three lines:

example.com {
    reverse_proxy localhost:3000
}

What the options add

OptionDirective
Load balancingreverse_proxy with several upstreams, lb_policy and optional active health checks
SPAtry_files {path} /index.html so client-side routes work on reload
Compressionencode zstd gzip
Security headersA header block with X-Content-Type-Options, Referrer-Policy, X-Frame-Options and removing Server
Basic authbasic_auth with a bcrypt hash on the path you choose

Related: Nginx Config Generator, Apache VirtualHost Generator, Docker Compose Generator.

Also searched as: caddy reverse proxy, caddyfile example, caddy config generator, caddy load balancer, caddy spa config, caddy php config, caddy basic auth.

Tools that pair well with the Caddyfile Generator

  • systemd Service Generator — Run your app as a proper Linux service that starts on boot and restarts when it crashes.
  • SSL Checker — Verify an HTTPS certificate in seconds — see when it expires, who issued it, which hostnames it covers and whether the chain is trusted.
  • YAML Validator — Paste a Docker Compose file, Kubernetes manifest, GitHub Actions workflow or any YAML to pinpoint errors, catch common pitfalls and get a cleanly formatted version.
  • Kubernetes YAML Generator — Fill in your app’s name, image and port and get production-ready Kubernetes YAML: a Deployment with probes, resource limits and a hardened security context, plus the Service, Ingress with TLS, ConfigMap, Secret and HorizontalPodAutoscaler you tick — in one file ready for kubectl apply.

Frequently asked questions

Does Caddy really set up HTTPS automatically?
Yes. When the site address is a public domain that points to your server and ports 80 and 443 are open, Caddy gets a certificate from Let’s Encrypt or ZeroSSL and renews it on its own.
How do I reverse proxy to several servers?
List the upstreams separated by spaces. Caddy balances requests between them; tick Health checks so it stops sending traffic to an upstream that is down.
How do I protect a page with a password?
Tick Basic auth, enter a username and a bcrypt hash of the password (from caddy hash-password), and the path to protect.
How do I serve a React or Vue app?
Choose SPA: Caddy serves the files and sends unknown paths to index.html, so client-side routing works when you reload a page.
Can I install Caddyfile Generator as a web app and use it offline?
Yes. Caddyfile Generator is an installable web app (PWA) — installed from your browser, not downloaded from an app store. Click Install app at the top of this page in Chrome or Edge (Windows, macOS, Linux, ChromeOS) or on Android, use Share → Add to Home Screen on iPhone and iPad, or File → Add to Dock in Safari 17+ on a Mac. It then opens in its own window with its own icon, and because it runs entirely in your browser it keeps working offline. Firefox on desktop can’t install web apps. How installing works.

Related tools