From 40d755b44e215d34cc17a4afab79abb7c117b627 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 11 Oct 2022 15:39:13 +0800 Subject: [PATCH] up --- plugins/op_waf/index.py | 1 - plugins/op_waf/waf/lua/common.lua | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/op_waf/index.py b/plugins/op_waf/index.py index b064dd07f..43a2f4bd3 100755 --- a/plugins/op_waf/index.py +++ b/plugins/op_waf/index.py @@ -132,7 +132,6 @@ def initSiteInfo(): 'cdn-src-ip', 'cdn-real-ip', 'cf-connecting-ip', - 'cf-connecting-ip', 'x-cluster-client-ip', 'wl-proxy-client-ip', 'proxy-client-ip', diff --git a/plugins/op_waf/waf/lua/common.lua b/plugins/op_waf/waf/lua/common.lua index 662d95dbb..e0a057a30 100644 --- a/plugins/op_waf/waf/lua/common.lua +++ b/plugins/op_waf/waf/lua/common.lua @@ -522,6 +522,7 @@ function _M.get_real_ip(self, server_name) self:D("ipheader[0]:"..self:to_json(request_header)) if self.site_config[server_name] then if self.site_config[server_name]['cdn'] then + local request_header = self.params["request_header"] for _,v in ipairs(self.site_config[server_name]['cdn_header']) do if request_header[v] ~= nil and request_header[v] ~= "" then @@ -534,6 +535,7 @@ function _M.get_real_ip(self, server_name) end end + self:D("client_ip[cf]:"..client_ip) if string.match(client_ip,"%d+%.%d+%.%d+%.%d+") == nil or not self:is_ipaddr(client_ip) then client_ip = ngx.var.remote_addr self:D("client_ip[2]:"..client_ip) @@ -549,7 +551,6 @@ end function _M.get_client_ip(self) local client_ip = "unknown" local server_name = self.params['server_name'] - -- self:D("fff..."..client_ip..server_name) if self.site_config[server_name] then if self.site_config[server_name]['cdn'] then request_header = self.params["request_header"]