Skip to content

Caddyfile

The current Caddyfile directive is wafx. It will be renamed in a later release. The module identifier is http.handlers.wafx, and it is ordered before reverse_proxy.

The original waf_chaitin directive from the starting fork is unchanged.

wafx {
mode block | detect_only
log_file <path>
coraza {
load_owasp_crs
directives ` ... `
}
t1k {
waf_engine_addr <IP:port>
}
}

block denies matching requests. detect_only logs the match and continues. The mode applies to both engines.

Writes JSONL decision records to the given path. Records include fields such as engine, action, rule_id, and event_id. The same fields appear on the Caddy logger.

Runs Coraza.

  • load_owasp_crs mounts the embedded OWASP CRS rules. @ paths resolve to these embedded sets. They are not files on disk.
  • directives takes a Coraza directives block.

Runs the T1K client against a SafeLine detector.

  • waf_engine_addr takes an address in the form IP:port. Unix sockets are rejected, same as waf_chaitin.

T1K needs a separate SafeLine detector process. Tlapiani does not include one.

example.com {
wafx {
log_file /var/log/caddy/wafx.jsonl
coraza {
load_owasp_crs
directives `
Include @coraza.conf-recommended
Include @crs-setup.conf.example
Include @owasp_crs/*.conf
SecRuleEngine On
`
}
}
reverse_proxy 127.0.0.1:8080
}

TCP :8000. Addresses are IP:port.

wafx {
t1k {
waf_engine_addr 169.254.0.5:8000
}
}
wafx {
mode block
coraza { load_owasp_crs
directives `
Include @coraza.conf-recommended
Include @crs-setup.conf.example
Include @owasp_crs/*.conf
SecRuleEngine On
`
}
t1k {
waf_engine_addr 169.254.0.5:8000
}
}
  • Evaluation order is fixed: Coraza request phases first, then T1K. A Coraza deny does not call T1K.
  • Coraza blocks with the rule status. CRS deny returns 403.
  • T1K returns 501, with the same JSON shape as before.
  • Coraza and T1K errors fail open.
  • Only request phases run. CRS response rules in phases 3 and 4 are not applied.

Prometheus metrics for coraza and t1k:

  • caddy_waf_engine_requests_total{engine,action}
  • caddy_waf_engine_detect_duration_seconds{engine}

Existing T1K pool and health metrics are unchanged.