patch 20191217

ngx.req.get_headers(0) 无限次匹配,可能会造成服务器拒绝服务负担
pull/3/head
174001602 2019-12-17 12:05:49 +08:00 committed by GitHub
parent 10008e82e0
commit 87b5c966eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -3,9 +3,9 @@ require "config"
-- Get the client IP
function get_client_ip()
local CLIENT_IP = ngx.req.get_headers()["X_real_ip"]
local CLIENT_IP = ngx.req.get_headers(0)["X_real_ip"]
if CLIENT_IP == nil then
CLIENT_IP = ngx.req.get_headers()["X_Forwarded_For"]
CLIENT_IP = ngx.req.get_headers(0)["X_Forwarded_For"]
end
if CLIENT_IP == nil then
CLIENT_IP = ngx.var.remote_addr