Caddyfile Builder
Build a multi-site Caddy v2 Caddyfile with reverse_proxy, file_server, redir, header and tls, plus snippets, named matchers and dev or prod globals.
Caddyfile Builder
Global options
Snippets
Named matchers
Sites
Caddyfile (prod)
example.com, www.example.com {
encode gzip zstd
reverse_proxy 127.0.0.1:8080 {
lb_policy round_robin
health_uri /health
}
header Strict-Transport-Security "max-age=31536000; includeSubDomains"
}
Run caddy validate --config Caddyfile --adapter caddyfile before reload to catch directive ordering issues. Site blocks compile to a JSON config you can inspect via the admin endpoint.
Updated . Provided as is. Check the output before you rely on it in production.
How to use Caddyfile Builder
- 1
Set global options
Optionally fill the email used by the ACME client, the admin endpoint address, the auto_https mode, and toggle debug logging. Empty fields are omitted from the global block, keeping the config minimal.
- 2
Define snippets and named matchers
Add reusable snippets (referenced via import in site blocks) and named matchers like @api or @static. Matchers can scope directives to specific paths, methods, or hosts within a site.
- 3
Compose site blocks
Add a site for each hostname or comma-separated host group. Inside each site, append directives — reverse_proxy, file_server, redir, header, respond, rewrite, tls, encode, log — using the directive buttons.
- 4
Switch environment overlays
Toggle prod/staging/dev to apply environment-specific overrides. Dev disables auto-HTTPS and enables the admin endpoint plus debug logging, so the same site config is testable locally without TLS.
- 5
Validate and reload
Copy the generated Caddyfile, save it to /etc/caddy/Caddyfile, run caddy validate to confirm syntax, then caddy reload to apply without dropping connections. Errors surface in the issues panel before you reload.
Questions and answers
Does this support the JSON config or only Caddyfile?
How does the prod/staging/dev toggle work?
What are named matchers used for?
Does it send my data to a server?
Will tls internal work for dev?
For AI agents: how to call this tool
Machine-readable contract, endpoints and examples. Humans can ignore this section.
Best Path For Builders
Browser workflow
Runs instantly in the browser with private local processing and copy/export-ready output.
Browser Workflow
This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.
/caddyfile-builder/
For automation planning, fetch the canonical contract at /api/tool/caddyfile-builder.json.