feat: support variable when rewrite header in proxy rewrite plugin#9112
Merged
spacewander merged 4 commits intoMar 24, 2023
Conversation
spacewander
reviewed
Mar 21, 2023
| local resolve_var_with_captures | ||
| do | ||
| local _captures | ||
| -- escape is not supported very well, like there si a redundant '\' after escape "$1" |
Member
There was a problem hiding this comment.
Suggested change
| -- escape is not supported very well, like there si a redundant '\' after escape "$1" | |
| -- escape is not supported very well, like there is a redundant '\' after escape "$1" |
| if not m then | ||
| if err then | ||
| core.log.error("match error in proxy-rewrite plugin, please check: ", err) | ||
| return |
Member
There was a problem hiding this comment.
Do we need to return a 503 for this error?
Contributor
Author
There was a problem hiding this comment.
I prefer 500, it's an unexpected condition
|
|
||
| local m, err = re_match(upstream_uri, conf.regex_uri[1], "jo") | ||
| if not m then | ||
| if err then |
Member
There was a problem hiding this comment.
We can merge the two conditions above?
Contributor
Author
There was a problem hiding this comment.
how? use the re_match first, then use the match result to replace?
leslie-tsang
self-requested a review
March 21, 2023 02:52
leslie-tsang
approved these changes
Mar 23, 2023
soulbird
reviewed
Mar 23, 2023
soulbird
approved these changes
Mar 23, 2023
spacewander
approved these changes
Mar 24, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Support for referencing the match result of the
regex_uriwhen rewrite header in the proxy-rewrite plugin, and the match result can be referenced as a variable by other plugins too.Nginx:
Apisix:
Checklist