Merge 8d718e31a0
into 314a2f62ec
commit
6727341293
8
init.lua
8
init.lua
|
@ -15,11 +15,9 @@ attacklog = optionIsOn(attacklog)
|
||||||
CCDeny = optionIsOn(CCDeny)
|
CCDeny = optionIsOn(CCDeny)
|
||||||
Redirect=optionIsOn(Redirect)
|
Redirect=optionIsOn(Redirect)
|
||||||
function getClientIp()
|
function getClientIp()
|
||||||
IP = ngx.var.remote_addr
|
local headers=ngx.req.get_headers()
|
||||||
if IP == nil then
|
local ip=headers["X-REAL-IP"] or headers["X_FORWARDED_FOR"] or ngx.var.remote_addr or "0.0.0.0"
|
||||||
IP = "unknown"
|
return ip
|
||||||
end
|
|
||||||
return IP
|
|
||||||
end
|
end
|
||||||
function write(logfile,msg)
|
function write(logfile,msg)
|
||||||
local fd = io.open(logfile,"ab")
|
local fd = io.open(logfile,"ab")
|
||||||
|
|
Loading…
Reference in New Issue