Merge pull request #3 from 174001602/patch-3

patch 20191217
pull/6/head
yeho 2019-12-18 18:44:08 +08:00 committed by GitHub
commit cbfb3d7066
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 -- Get the client IP
function get_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 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 end
if CLIENT_IP == nil then if CLIENT_IP == nil then
CLIENT_IP = ngx.var.remote_addr CLIENT_IP = ngx.var.remote_addr