f0825d6497
The WAF handler always prepended 'Include @coraza.conf-recommended' to the SecLang directives regardless of load_owasp_crs. The @-prefixed paths only resolve from the embedded coraza-coreruleset filesystem, which the Caddy WAF plugin mounts only when load_owasp_crs=true. Without it Caddy fails: "failed to readfile: open @coraza.conf-recommended: no such file or directory" Fix: gate all @-prefixed Include directives behind load_owasp_crs. Also extract buildWafHandler from caddy.ts into caddy-waf.ts so it can be unit tested in isolation, and add tests/unit/caddy-waf.test.ts (19 tests) covering the regression, CRS include ordering, excluded rule IDs, and handler structure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>