Web application firewall
The WAF is configured per proxy host under Host → Edit → Security · WAF. It is built on Coraza 2.6.2 with OWASP CRS 4.25.0, pinned into the image.
Modes
| Mode | Effect | When to use it |
|---|---|---|
| Off (explicit) | No inspection handler is compiled for the host. | Every host until you have reviewed its traffic. |
| Monitor | Requests are inspected; matches are recorded as WAF_MATCH events with the rule id; the request is forwarded. | The first one to two weeks for a new host. |
| Block | The rule set is enforced. A match returns the host's error page with 403 and a reference. | After the monitor events look like false positives only. |
| Inherit the deployment default | Follows the node default shown in the selector. | When one policy should apply to most hosts. |
Mode is a property of the host, so a single deployment can run one host in monitor mode and another in block mode.
What is inspected
- Requests only. Response bodies are not buffered or inspected in this release, which is why logins, streaming and downloads keep working.
- The request body is inspected up to 32 MiB. A larger body is inspected partially and forwarded; it is never rejected merely for its size.
- Inspection happens before the request reaches the upstream.
- A matching request in monitor mode still reaches the origin. In block mode the origin never sees it.
Choosing block mode
- Enable Monitor and apply a revision.
- Let real traffic through for a period.
- Open Security → WAF and review the matched rule ids, hosts and paths.
- If the matches are attacks, switch the host to Block. If a match is a false positive, add a narrow exception first.
In block mode a matching request never reaches the origin. The visitor sees the host's error page with a reference you can look up in Security → Security events:

Narrow exceptions
An exception turns off one rule for an optional method, an optional path prefix and an optional single field:
| Field selector | Targets |
|---|---|
ARGS:name | One query or form argument |
REQUEST_HEADERS:name | One request header |
REQUEST_COOKIES:name | One cookie |
REQUEST_URI | The URI itself |
REQUEST_BODY | The body |
- A reason is mandatory; the expiry date is optional.
- An expired exception stays in the record but is not compiled.
- An exception for
GET /search ARGS:qadmits that one request shape only; the same rule still blocks on every other path. - Free-form directives cannot be written through the console. Unsafe field values are rejected, not escaped.
The node's detailed WAF record
Every match is also written to a raw record on the node for debugging:
| Property | Default |
|---|---|
| File | /data/caddy/waf-audit.log |
| Access | Owner-only (0600); the directory is not published |
| Rotation | By size (32 MiB) and by age (24 hours) |
| Retention | Rolled files past the retention age are deleted, and the retained set is capped at 512 MiB |
| Content | Rule id, message, host, URI and the per-request reference — never a body, cookie or credential |
The raw record stays on the node. It is not stored in PostgreSQL and is not part of the central aggregates; only the sanitized security-event summary is stored centrally. Exclude the raw record from backups and replication, or accept that it will be captured.
Checking the engine
The versions above can be confirmed from the engine container:
docker compose exec -T caddy caddy version
docker compose exec -T caddy caddy list-modules --versions | grep -E 'waf|crowdsec'
A mismatch between the environment's recorded CRS version and the rule bundle would be a build defect. The bundle is what the image contains.