Authored by chunhua.zhang

add

... ... @@ -13,7 +13,14 @@ local local_cidr = {
-- check if ip is local
-- depends on ngx.real_ip from setup.lua
function check_local_access(ip)
function check_local_access()
-- read ip from ngx.real_ip
local ip = ngx.real_ip
if (ngx.real_ip == nil or ngx.real_ip == '') then
return
end
local is_local_ip = false
for i = 1, #local_cidr do
local is_in_cidr = iptool:pcall_check_ip_in_ipblock(ip, local_cidr[i],false)
... ... @@ -23,10 +30,6 @@ function check_local_access(ip)
end
end
if (ngx.real_ip == nil or ngx.real_ip == '') then
return
end
if not is_local_ip then
ngx.exit(403);
return
... ...