Caddyfile Builder
Generate and validate Caddy Server configuration locally in your browser
About
Generate deterministic nested Caddyfile routes and validate existing files locally without uploading configuration.
Examples
Reverse proxy plus static files
generateCaddyfile({ siteAddress: "example.com", routes: [{ type: "reverse_proxy", path: "/api/*", upstreams: ["localhost:3000"] }, { type: "handle_path", path: "/static/*", root: "/srv/www" }] })example.com {\n reverse_proxy /api/* localhost:3000\n handle_path /static/* {\n root * /srv/www\n file_server\n }\n}Proxy routes emit one line with all upstreams; handle_path routes nest root and file_server in a sub-block.
Redirect with status control
generateCaddyfile({ siteAddress: "example.com", routes: [{ type: "redir", from: "/old", to: "/new" }] })redir /old /new 308 (302 when permanent: false)Redirections default to permanent 308; passing permanent: false switches the emitted status to 302.
About this tool
Caddyfile Builder generates server blocks with generateCaddyfile({ siteAddress, routes }): the address (default :80) opens the block and each route emits its directive — handle_path with root plus file_server, reverse_proxy with upstream list (default localhost:3000), basic_auth with username and password hash, encode with algorithm list (default gzip), header with sorted +set and -delete entries, and redir with from/to plus 308 by default (302 only when permanent: false).
Validation comes from validateCaddyfile(source): a brace tracker ignoring # comments and quoted strings reports Unmatched closing brace and Unclosed block: missing } errors, a site address mixed with a directive on one line is an error, and first tokens inside a block that match neither the known directive set (root, file_server, reverse_proxy, handle_path, basic_auth, encode, header, redir, respond, route, handle, log, tls, @id) nor +/- header modifiers produce Unknown Caddyfile directive warnings. Results sort by line with errors first.
Localhost HTTPS expectations are explicit via localhostHttpsNotice(siteAddress): localhost, localhost:<port>, and bare :<port> addresses return the notice that Caddy will not obtain a public HTTPS certificate there — any real domain returns null and qualifies for automatic HTTPS.
How to use this tool
Set the site address
Enter a domain for automatic HTTPS, or a localhost/bare-port address when testing locally (the tool flags the HTTPS limitation for you).
Add routes
Stack reverse_proxy upstreams, handle_path file roots, header rewrites, basic_auth, encode, and redir entries — header set/delete lines sort automatically.
Validate before deploying
Run validateCaddyfile on the output: fix Unclosed block errors and review Unknown Caddyfile directive warnings for typos.
Use cases
Fronting Node apps with Caddy
Emit a reverse_proxy block pointing at localhost:3000 behind a real domain for automatic HTTPS.
Serving static assets alongside an API
Combine a handle_path file_server root for /static/* with proxy and header routes in one site block.
Migrating legacy paths
Generate redir from/to rules with explicit 308/302 status before wiring them into the live Caddyfile.
Common mistakes
Mistake:Leaving a site block unclosed.
Fix:Every opened { needs its closing } — validateCaddyfile reports the exact opening line as Unclosed block: missing }.
Mistake:Typing a directive name slightly wrong.
Fix:Unknown names yield an Unknown Caddyfile directive warning, not an error — check the spelling against root, reverse_proxy, redir, header, encode, and friends.
Mistake:Expecting public HTTPS on localhost.
Fix:Caddy only provisions public certificates for real domains; localhost and bare ports always return the localhostHttpsNotice limitation.
Frequently asked questions
What does this tool do?
It generates a Caddy site block (reverse_proxy, handle_path with file_server, header, basic_auth, encode, and redir routes) from your address and routes, validates pasted Caddyfiles for unclosed blocks and unknown directives, and tells you when an address cannot get automatic public HTTPS.
Why does localhost show an HTTPS notice?
Caddy only provisions public certificates for real domains. localhost, localhost:<port>, and bare :<port> addresses always return the localhostHttpsNotice limitation, while any real domain returns null and qualifies for automatic HTTPS.
Is my Caddyfile uploaded or stored?
No. Generation and validation run fully client-side — brace tracking, directive checks, and text assembly never leave your browser.
How do I fix Unclosed block and Unknown directive reports?
Unclosed block names the exact opening line missing its } — add the closing brace. Unknown Caddyfile directive is a warning for a first token outside the known set (reverse_proxy, redir, header, encode, and friends), so check the spelling rather than assuming it will work.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
AI Function Calling Schema Generator
Generate function calling JSON schemas from TypeScript interfaces
Algorithm Arena & Data Structure Visualizer
Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.
Ansible Playbook Generator
Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML