soulbird commented on code in PR #6988:
URL: https://github.com/apache/apisix/pull/6988#discussion_r870874491


##########
apisix/plugins/real-ip.lua:
##########
@@ -84,6 +103,17 @@ local function get_addr(conf, ctx)
             return addrs
         end
 
+        if conf.recursive and conf.trusted_addresses then
+            local split_addrs, _ = ngx_re_split(addrs, ",\\s*", "jo")

Review Comment:
   `local split_addrs = ngx_re_split(addrs, ",\\s*", "jo")` better? Or deal 
with the error?



##########
apisix/plugins/real-ip.lua:
##########
@@ -105,12 +135,8 @@ function _M.rewrite(conf, ctx)
     end
 
     if conf.trusted_addresses then
-        if not conf.matcher then
-            conf.matcher = core.ip.create_ip_matcher(conf.trusted_addresses)
-        end
-
         local remote_addr = ctx.var.remote_addr
-        local trusted = conf.matcher:match(remote_addr)
+        local trusted = addr_match(conf, remote_addr)
         if not trusted then
             return
         end

Review Comment:
   ```lua
   if not addr_match(conf, remote_addr) then
       return
   end
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to