mirror of
https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS.git
synced 2023-12-14 04:31:21 +00:00
Update anti_ddos_challenge.lua
Add Enable/disable script this feature allows you to turn on or off this script so you can leave this file in your nginx configuration permamently. This way you don't have to remove `access_by_lua_file anti_ddos_challenge.lua;` to stop protecting your websites :) you can set up your nginx config and use this feature to enable or disable protection.
This commit is contained in:
@ -208,6 +208,16 @@ Charset output of HTML page and scripts
|
||||
]]
|
||||
local default_charset = "utf-8"
|
||||
|
||||
--[[
|
||||
Enable/disable script this feature allows you to turn on or off this script so you can leave this file in your nginx configuration permamently.
|
||||
|
||||
This way you don't have to remove access_by_lua_file anti_ddos_challenge.lua; to stop protecting your websites :) you can set up your nginx config and use this feature to enable or disable protection
|
||||
|
||||
1 = enabled
|
||||
2 = disabled
|
||||
]]
|
||||
local master_switch = 1 --enabled by default
|
||||
|
||||
--[[
|
||||
End Configuration
|
||||
|
||||
@ -225,6 +235,15 @@ This is where things get very complex. ;)
|
||||
Begin Required Functions
|
||||
]]
|
||||
|
||||
--master switch check
|
||||
local function check_master_switch()
|
||||
if master_switch == 2 then --script disabled
|
||||
local output = ngx.exit(ngx.OK) --Go to content
|
||||
return output
|
||||
end
|
||||
end
|
||||
check_master_switch()
|
||||
|
||||
--function to check if ip address is whitelisted to bypass our auth
|
||||
local function check_ip_whitelist(ip_table)
|
||||
for key,value in pairs(ip_table) do
|
||||
|
Reference in New Issue
Block a user