You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To load custom rulesets during init you have to manipulate the global_rulesets table:
local lua_resty_waf = require("resty.waf")
-- delete all default entries
for i=1,#lua_resty_waf.global_rulesets,1 do
table.remove(lua_resty_waf.global_rulesets)
end
-- add your custom ruleset
table.insert(lua_resty_waf.global_rulesets, "10000_my_custom_ruleset")
lua_resty_waf.init()
your ruleset file must be in the same path of the other rules or in lib_path/rules and it must be named as 10000_my_custom_ruleset.json
Previously I thought the same thing as @rayward's proposition, but the table copies necessary to support such functionality were actually much more expensive. I'd be happy to consider for review efficient patches that provide such functionality. Thanks!
Loading of custom rulesets (as well as ignoring of built-in ones) is only possible during request phases.
It seems wasteful having to do this for every request if it could be done globally during init.
The text was updated successfully, but these errors were encountered: