bugfix: checked the router.global_rules first, it maybe nil. (#609)

This commit is contained in:
YuanSheng Wang 2019-09-27 04:15:56 +08:00 committed by GitHub
parent d5f7b1e008
commit a3b6a10fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,7 +240,8 @@ function _M.http_access_phase()
core.ctx.set_vars_meta(api_ctx) core.ctx.set_vars_meta(api_ctx)
-- load and run global rule -- load and run global rule
if router.global_rules.values and #router.global_rules.values > 0 then if router.global_rules and router.global_rules.values
and #router.global_rules.values > 0 then
local plugins = core.tablepool.fetch("plugins", 32, 0) local plugins = core.tablepool.fetch("plugins", 32, 0)
for _, global_rule in ipairs(router.global_rules.values) do for _, global_rule in ipairs(router.global_rules.values) do
api_ctx.conf_type = "global_rule" api_ctx.conf_type = "global_rule"