Skip to content

/errors/caddy/unrecognized-directive

Caddy: Caddyfile:2: unrecognized directive

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · v2.11.7 h1:yj0Y4fYZGPkSvibBJ1sTWE33xC0fxztVyXEW5iIdUT4=updated 2026-10-20
tool
Caddy
exit code
1
versions
Caddy 2
os
any

Caddy parses a Caddyfile into its JSON configuration before it starts. A line inside a site block whose first word is not a known directive stops caddy run, caddy validate and caddy adapt with Caddyfile:2: unrecognized directive: reverse_proxi, where 2 is the line number.

Reproduce it

caddy adapt converts the Caddyfile without starting a server:

bash
printf 'example.com {\n\treverse_proxi localhost:3000\n}\n' > Caddyfile
# Caddy logs as JSON; sed removes the timestamp field
caddy adapt --config Caddyfile 2>&1 | sed -E 's/"ts":[0-9.]+,//'
exit "${PIPESTATUS[0]}"

Output · exit 1

{"level":"error","msg":"Caddyfile:2: unrecognized directive: reverse_proxi"}

Fix it

caddyfile
example.com {
	reverse_proxy localhost:3000
}

If the directive is right but comes from a plugin, check whether your binary has it:

bash
caddy list-modules | grep -i rate_limit

Global options belong in the block at the very top, without an address:

caddyfile
{
	email admin@example.com
}

example.com {
	reverse_proxy localhost:3000
}

Sources