...
|
...
|
@@ -44,7 +44,7 @@ function do_degrade() |
|
|
local method = http_request.get_req_param("method")
|
|
|
|
|
|
if limit_ip_config and limit_ip_config.degrade_methods then
|
|
|
if limit_ip_config.degrade_methods[method]~=nil then
|
|
|
if contains(limit_ip_config.degrade_methods,method) then
|
|
|
ngx.log(ngx.ERR, "method is degraded.", method)
|
|
|
ngx.header["Content-Type"]="application/json;charset=utf-8"
|
|
|
local rsp_body = '{"code":9999991,"message":"limited"}'
|
...
|
...
|
@@ -54,6 +54,13 @@ function do_degrade() |
|
|
end
|
|
|
end
|
|
|
|
|
|
function contains(t, e)
|
|
|
for i = 1,#t do
|
|
|
if t[i] == e then return true end
|
|
|
end
|
|
|
return false
|
|
|
end
|
|
|
|
|
|
-------- function: doing rate limit by key[interface]-----
|
|
|
function rate_limit()
|
|
|
|
...
|
...
|
|