nic-6443 commented on code in PR #13800:
URL: https://github.com/apache/apisix/pull/13800#discussion_r3754956714


##########
apisix/plugins/proxy-rewrite.lua:
##########
@@ -355,8 +385,14 @@ function _M.rewrite(conf, ctx)
             if captures then
                 ctx.proxy_rewrite_regex_uri_captures = captures
 
+                local replacement = preserve_literal_dollars(conf.regex_uri[i 
+ 1])
+                replacement = 
core.utils.resolve_var_with_captures(replacement, captures)
+                replacement = core.utils.resolve_var(replacement, ctx.var, 
escape_separator)
+                replacement = restore_literal_dollars(replacement)
                 local uri, _, err = re_sub(upstream_uri,
-                    conf.regex_uri[i], conf.regex_uri[i + 1], "jo")
+                    conf.regex_uri[i], function()
+                        return replacement
+                    end, "jo")

Review Comment:
   It's too complicated. Is there a simpler way?



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