prepare for v1.3.2
This commit is contained in:
@@ -23,8 +23,16 @@ local use_remote_api = {% if USE_REMOTE_API == "yes" %}true{% else %}
|
||||
local remoteapi = require "remoteapi"
|
||||
local iputils = require "resty.iputils"
|
||||
|
||||
if use_remote_api and not iputils.ip_in_cidrs(ngx.var.remote_addr, cjson.decode(ngx.shared.reserved_ips:get("data"))) and ngx.shared.remote_api:get("id") ~= "empty" and ngx.shared.remote_api:get("ping") ~= "ko" then
|
||||
if ngx.status == ngx.HTTP_FORBIDDEN then
|
||||
if use_remote_api and not iputils.ip_in_cidrs(ngx.var.remote_addr, cjson.decode(ngx.shared.reserved_ips:get("data"))) and ngx.shared.remote_api:get("id") ~= "empty" then
|
||||
if ngx.shared.remote_api:get("ping") == "ko" then
|
||||
if remoteapi.ping2() then
|
||||
ngx.shared.remote_api:set("ping", "ok", 0)
|
||||
logger.log(ngx.NOTICE, "REMOTE API", "Successfully requested the remote API again")
|
||||
else
|
||||
logger.log(ngx.ERR, "REMOTE API", "Can't contact the remote API, feature will be disabled")
|
||||
end
|
||||
end
|
||||
if ngx.shared.remote_api:get("ping") ~= "ko" and ngx.status == ngx.HTTP_FORBIDDEN then
|
||||
local reason = "other"
|
||||
if use_bad_behavior and new_bad_behavior_ban then
|
||||
reason = "behavior"
|
||||
|
||||
Reference in New Issue
Block a user