About this tool
Build a Caddy v2 Caddyfile with automatic HTTPS, reverse proxy or file server, compression, headers and logging.
This generator assembles a complete Caddy v2 Caddyfile site block from a form — reverse proxy or static file server, encode zstd gzip compression, baseline security headers, optional HSTS, a www-to-apex redirect and file-based access logging. It follows the Caddyfile conventions from the official docs, including automatic HTTPS for hostname addresses and the try_files {path} /index.html fallback pattern for single-page applications.
Open Caddyfile Generator on AltFTool — it loads instantly in your browser.
Upload or drag in the file you want to work with.
Adjust the settings and preview the result.
Download the finished file to your device.
Hostname addresses get Caddy's built-in certificate provisioning; port-only addresses are flagged as plain HTTP.
Uses the documented try_files {path} /index.html pattern so real files win and everything else serves the app shell.
HSTS defaults to the one-year preload minimum of 31536000 seconds and refuses values over two years as likely unit mistakes.
Yes — for any site address with a hostname and no explicit http:// prefix, Caddy obtains, installs and renews TLS certificates automatically via ACME (Let's Encrypt or ZeroSSL). The only prerequisites are that DNS points at the server and ports 80 and 443 are reachable.
A two-line site block is enough: example.com { reverse_proxy localhost:3000 }. Caddy's reverse_proxy forwards the Host header and sets X-Forwarded-For and X-Forwarded-Proto automatically, which nginx requires several proxy_set_header lines to achieve.
Combine root, try_files and file_server: root * /srv/app, then try_files {path} /index.html, then file_server. Real files like JS bundles are served directly, and any other path — such as a client-side route like /dashboard — falls back to index.html.
31536000 seconds (one year) is the standard value and the minimum for the hstspreload.org list. Start lower (for example 300) while testing, because HSTS makes browsers refuse plain-HTTP connections to your domain — and with includeSubDomains, to every subdomain — until the timer expires.