bzp2010 opened a new pull request, #8718: URL: https://github.com/apache/apisix/pull/8718
### Description APISIX started to provide `_meta.priority` plugin field in 2.13 to help users rewrite the hard-coded plugin priority at runtime, so users can arbitrarily combine various plug-ins and use different order of precedence. When trying to use a combination of proxy-rewrite and proxy-mirror, a logical error occurs. In the default configuration, mirror takes precedence over rewrite, and when the user rewrites the uri, it does not take effect in mirror, which is not the user's expectation, so the user can rewrite the priority. However, when you rewrite the priority you will find that the uri rewrite still does not take effect, because the mirror plugin uses the uri field in the nginx variable directly, ignoring the upstream_uri variable that other APISIX plugins can rewrite, which is the key to uri rewriting. We can fix this behavior by using logic such as: - If `upstream_uri ! = nil` and `upstream_uri ! = ""` (which means that other plugins or APISIX itself has rewritten the uri), mirror uses the `upstream_uri` value as the new uri, while the existing prefix settings are not affected. - If `upstream_uri` is empty, it follows the same logic as before and uses `var.uri` to splice args. With this logic, any old usage is not affected (as you can see, I did not modify any of the old test cases), and this modification only takes effect when the user modifies the priority, modifies the uri in advance, or modifies the uri through other custom plugins, with minimal impact. Fixes #8167 Mail list: https://lists.apache.org/thread/8y3kxrwxl9yh9f049660kbc1ob8vhqkk _BTW, I noticed that no one has raised any issues in the formal discussion channels (mail list), that thread has been there for three months. So I will assume that no one has objected to that. And as I showed in the description above, this solution has minimal impact and does not cause any disruptive behavior._ ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [x] I have added tests corresponding to this change - [ ] I have updated the documentation to reflect this change - [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first) <!-- Note 1. Mark the PR as draft until it's ready to be reviewed. 2. Always add/update tests for any changes unless you have a good reason. 3. Always update the documentation to reflect the changes made in the PR. 4. Make a new commit to resolve conversations instead of `push -f`. 5. To resolve merge conflicts, merge master instead of rebasing. 6. Use "request review" to notify the reviewer after making changes. 7. Only a reviewer can mark a conversation as resolved. --> -- 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]
