Skip to main content

Developer Tools · Developer

Caddyfile Validator

Validate a Caddy v2 Caddyfile in your browser: find syntax and structure errors line by line with clear reasons and fixes, plus a structure tree.

Last updated:

How to use

Expand how to use
  1. 1

    Paste your Caddyfile

    Paste the Caddy v2 Caddyfile you want to validate into the text area. You can also start from a sample.

  2. 2

    Review the issues and fix them

    Issues are listed by severity. Each entry explains why it is a problem and how to fix it, and clicking the line number jumps to that line.

  3. 3

    Check the structure tree

    The tree shows global options, snippets, sites, matchers, and directives so you can grasp the routing structure at a glance.

Caddyfile

Everything runs in your browser. Your config is never sent to a server.

Paste a Caddyfile to validate its syntax and structure. You can also start from a sample.

About the Caddyfile Validator

The Caddyfile Validator parses a Caddy v2 Caddyfile in your browser and reports syntax and structure problems line by line. It checks brace balance, the position of the global options block, duplicate site addresses, snippet and import consistency, and undefined named matchers, plus common configuration mistakes around reverse_proxy upstreams, handle_path matchers, basic_auth password hashes, and tls arguments — 15 rules in total. Every finding comes with the reason it matters and a concrete fix, along with a link to the relevant page of the official Caddy documentation. The tool also renders a structure tree of global options, snippets, site blocks, matchers, and directives so you can grasp your routing at a glance. Everything runs in your browser, and your configuration is never sent to a server.

Key features

  • Validates Caddy v2 Caddyfile syntax and structure with 15 rules
  • Shows the reason, a concrete fix, and a link to the official docs
  • Visualizes sites, matchers, and directives as a structure tree
  • Runs entirely in your browser with no data sent to any server

When it helps

  • Checking a Caddyfile copied from a blog post before deploying it
  • Understanding how reverse_proxy and handle_path route requests
  • Catching broken snippet imports and typos in named matchers
  • Reviewing a homelab setup that serves several sites from one file

Frequently asked questions

Is my Caddyfile sent anywhere?

No. Parsing and validation run entirely in your browser with JavaScript, and your Caddyfile is never sent to a server. Config files often contain internal hostnames and paths, so this was the top design priority.

How is this different from `caddy validate`?

`caddy validate` is the official command and runs on a machine where Caddy is installed, so it is the most accurate check. This tool is different in that it works in the browser before you install anything, explains the reason and a fix for every finding, and draws a structure tree of your sites. Use `caddy validate` for the final check.

Does it support Caddy v1 Caddyfiles or JSON configs?

No. This tool targets the Caddy v2 Caddyfile format only. If you paste a v1 Caddyfile or a JSON config, it detects that and tells you it is out of scope.

Why are unknown directives not reported as errors?

Caddy plugins can add their own directives, so a name that is missing from the standard list can still be valid. To avoid false positives, unknown directives are reported as information only.

Can I import a snippet before it is defined?

No. Caddy resolves the Caddyfile from top to bottom, so a snippet that is not defined yet when `import` runs cannot be found. Put snippet definitions near the top of the file. This tool checks that ordering for you.