Authored by chunhua.zhang

add

... ... @@ -201,11 +201,22 @@ function init_read_body()
end
end
function helper_table_contains(t, value)
if not t or not value or value == '' then
return false
end
for i, v in ipairs(t) do
if v == value then return true end
end
return false
end
function limit_ufo_local()
if ngx.var.host == '2.yohobuy.com' or ngx.var.host == 'ufoapi.yohoops.org' or ngx.var.host == '2gray.yohobuy.com' then
local method = 'ufo.coupons.send' --only allow local access
local t_local_methods = { 'ufo.coupons.send' } --only allow local access
local m = http_request.get_method()
if method == m then
if helper_table_contains(t_local_methods, m) then
local is_local = limit_local:check_local_access()
if not is_local then
ngx.log(ngx.ERR, "DENY NOT LOCAL ACCESS.")
... ...