You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org> on 2023/03/22 15:59:36 UTC
[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #9112: feat: support variable when rewrite header in proxy rewrite plugin
monkeyDluffy6017 commented on code in PR #9112:
URL: https://github.com/apache/apisix/pull/9112#discussion_r1145055981
##########
apisix/plugins/proxy-rewrite.lua:
##########
@@ -278,15 +284,24 @@ function _M.rewrite(conf, ctx)
local uri, _, err = re_sub(upstream_uri, conf.regex_uri[1],
conf.regex_uri[2], "jo")
- if uri then
- upstream_uri = uri
- else
+ 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}
end
+
+ local m, err = re_match(upstream_uri, conf.regex_uri[1], "jo")
+ if not m then
+ if err then
+ core.log.error("match error in proxy-rewrite plugin, please check: ", err)
+ return
Review Comment:
I prefer 500
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org