monkeyDluffy6017 commented on code in PR #9194:
URL: https://github.com/apache/apisix/pull/9194#discussion_r1179461817


##########
apisix/plugins/proxy-rewrite.lua:
##########
@@ -281,25 +281,32 @@ function _M.rewrite(conf, ctx)
         if not str_find(upstream_uri, "?") then
             separator_escaped = true
         end
-
-        local uri, _, err = re_sub(upstream_uri, conf.regex_uri[1],
-                                   conf.regex_uri[2], "jo")
-        if not uri then
-            local msg = "failed to substitute the uri " .. ctx.var.uri ..
-                        " (" .. conf.regex_uri[1] .. ") with " ..
-                        conf.regex_uri[2] .. " : " .. err
-            core.log.error(msg)
-            return 500, {message = msg}
+        local error_msg
+        for i = 1, #conf.regex_uri, 2 do
+            local captures, err = re_match(upstream_uri, conf.regex_uri[i], 
"jo")
+            if err then
+                error_msg = "failed to match the uri " .. ctx.var.uri ..
+                    " (" .. conf.regex_uri[i] .. ") " .. err

Review Comment:
   local error_msg = "failed to substitute the uri " .. ctx.var.uri ..
                           " (" .. conf.regex_uri[1] .. ") with " ..
                           conf.regex_uri[2] .. " : " .. err



-- 
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