Baoyuantop commented on code in PR #13311:
URL: https://github.com/apache/apisix/pull/13311#discussion_r4356466138
##########
apisix/plugins/chaitin-waf.lua:
##########
@@ -314,6 +318,11 @@ local function do_access(conf, ctx)
extra_headers[HEADER_CHAITIN_WAF] = "unhealthy"
extra_headers[HEADER_CHAITIN_WAF_ERROR] = tostring(err)
+ if conf.allow_degradation then
+ core.log.warn("chaitin-waf: no healthy nodes, degradation enabled,
passing request")
+ return nil, nil, extra_headers
Review Comment:
Good coverage for “no healthy nodes”. A few lines above, the missing
metadata / no `nodes` path still always `return 500` and ignores
`allow_degradation` (even `monitor` hits 500 there today). For a consistent
failure policy, please honor `allow_degradation` on that path too (pass + warn
log when enabled), and add a test for it.
##########
apisix/plugins/chaitin-waf.lua:
##########
@@ -65,6 +65,10 @@ local plugin_schema = {
type = "boolean",
default = false
},
+ allow_degradation = {
+ type = "boolean",
+ default = false
+ },
Review Comment:
`allow_degradation` is only on `plugin_schema`. Please also add it to
`metadata_schema`, and resolve it with the same precedence as `mode`
(route/plugin conf > metadata > default), so operators can set a global default
without repeating it on every Route.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]