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.
Directive structure
Section titled “Directive structure”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.
log_file <path>
Section titled “log_file <path>”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.
coraza { ... }
Section titled “coraza { ... }”Runs Coraza.
load_owasp_crsmounts the embedded OWASP CRS rules.@paths resolve to these embedded sets. They are not files on disk.directivestakes a Coraza directives block.
t1k { ... }
Section titled “t1k { ... }”Runs the T1K client against a SafeLine detector.
waf_engine_addrtakes an address in the formIP:port. Unix sockets are rejected, same aswaf_chaitin.
T1K needs a separate SafeLine detector process. Tlapiani does not include one.
Examples
Section titled “Examples”Coraza with OWASP CRS only
Section titled “Coraza with OWASP CRS only”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}T1K only, against a SafeLine detector
Section titled “T1K only, against a SafeLine detector”TCP :8000. Addresses are IP:port.
wafx { t1k { waf_engine_addr 169.254.0.5:8000 }}Both engines, Coraza first
Section titled “Both engines, Coraza first”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 }}Behavior notes
Section titled “Behavior notes”- 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.
Metrics
Section titled “Metrics”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.