@@ -78,13 +78,24 @@ Coraza needs to run request-phase rules:
7878Response-phase inspection is deliberately out of scope for M1
7979(see ADR-007).
8080
81- ## Failure behaviour
81+ ## Degraded-mode behaviour
8282
8383` spoe-agent ` is configured with ` option set-on-error error ` . If the
84- SPOA is unreachable or returns an error, ` txn.coraza.action ` will not
85- equal ` "deny" ` and the request is forwarded — i.e. the proxy
86- fail-opens. Hardening this into an explicit degraded mode is tracked
87- in #80 ; M1 only needs the happy path.
84+ SPOA is unreachable, times out, returns a malformed response, or
85+ returns an internal processing error, HAProxy sets
86+ ` txn.coraza.error ` to the SPOE/SPOP error code.
87+
88+ The M1 reference configuration fails closed for protected traffic:
89+ when ` txn.coraza.error ` is present, HAProxy returns
90+ ` 503 Service Unavailable ` before contacting ` be_app ` . The response
91+ includes ` X-WAF-Degraded: true ` and ` X-WAF-Error: <code> ` so operators
92+ can distinguish WAF degraded mode from an application outage. HAProxy
93+ also raises the request log level to ` err ` for these requests.
94+
95+ This covers startup or unhealthy Coraza containers, connection
96+ failures, SPOE processing timeouts, malformed WAF responses, and
97+ transient runtime failures. Backend/dashboard status reporting is
98+ tracked separately in #69 .
8899
89100## Troubleshooting SPOE frames
90101
@@ -128,9 +139,10 @@ mode uses `info` logging.
1281395 . If HAProxy returns ` 421 ` , the request failed the reference host ACL
129140 before routing. Retry with ` Host: app.local ` .
130141
131- 6 . If HAProxy returns an application response while Coraza is down,
132- this is the expected M1 fail-open behavior from `option
133- set-on-error error`; degraded-mode handling is tracked in #80 .
142+ 6 . If HAProxy returns ` 503 ` with ` X-WAF-Degraded: true ` , Coraza/SPOA
143+ inspection failed and the proxy failed closed before contacting the
144+ backend. Use the ` X-WAF-Error ` value and HAProxy ` err ` log line to
145+ identify the SPOE/SPOP failure class.
134146
135147For raw frame inspection in the Docker Compose setup, capture the SPOA
136148traffic from inside the ` haproxy ` container while reproducing the
0 commit comments