Update init.lua

pull/13/head
loveshell 2013-11-08 10:17:46 +08:00
parent aaf0dfc2a9
commit c63ec5e395
1 changed files with 12 additions and 2 deletions

View File

@ -13,9 +13,7 @@ WhiteCheck = optionIsOn(whiteModule)
PathInfoFix = optionIsOn(PathInfoFix)
attacklog = optionIsOn(attacklog)
CCDeny = optionIsOn(CCDeny)
CCrate = CCrate
Redirect=optionIsOn(Redirect)
ipWhitelist=ipWhitelist
function getClientIp()
IP = ngx.req.get_headers()["X-Real-IP"]
if IP == nil then
@ -202,3 +200,15 @@ function whiteip()
end
return false
end
function blockip()
if next(ipBlocklist) ~= nil then
for _,ip in pairs(ipBlocklist) do
if getClientIp()==ip then
ngx.exit(403)
return true
end
end
end
return false
end