Skip to content

Commit cf2ad9a

Browse files
committed
feat: only check auth on maanger route
1 parent 6fcdfb5 commit cf2ad9a

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

lib/resty/waf/modules/manager.lua

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,18 @@ function _M.run(config)
99
if config.modules.manager.enable ~= true then
1010
return
1111
end
12-
1312
local base_uri = '/waf'
14-
if string.find(ngx.var.uri, base_uri) ~= 1 then
15-
return
16-
end
17-
18-
_M.auth_check(config.modules.manager.auth)
19-
20-
local uri = ngx.var.uri
2113
local method = ngx.req.get_method()
2214
local path = string.sub( ngx.var.uri, string.len( base_uri ) + 1 )
2315
for i,item in ipairs( _M.routes) do
2416
if method == item['method'] and path == item['path'] then
17+
_M.auth_check(config.modules.manager.auth)
2518
ngx.header.content_type = "application/json"
2619
ngx.header.charset = "utf-8"
2720
ngx.say(item['handle'](config))
2821
ngx.exit(ngx.HTTP_OK)
2922
end
3023
end
31-
ngx.status = ngx.HTTP_NOT_FOUND
32-
ngx.header.content_type = "application/json"
33-
ngx.say('{"code": 404, "message":"Not Found"}')
34-
ngx.exit(ngx.HTTP_OK)
3524
end
3625

3726
function _M.config_get(config)

0 commit comments

Comments
 (0)