bzp2010 opened a new issue, #8167:
URL: https://github.com/apache/apisix/issues/8167
### Current Behavior
The route configuration (omitted some irrelevant content):
```
{
"uri": "/v1/hello/*",
"plugins": {
"proxy-mirror": {
"sample_ratio": 1,
"host": "http://mirror.api:8082"
},
"proxy-rewrite": {
"regex_uri": [
"/v1/(.*)",
"/$1"
],
"_meta": {
"priority": 2000
}
}
}
}
```
The client uses this URI to request:
```
GET /v1/hello
```
Requests to the upstream will be rewritten as:
```
GET /hello
```
But the request to the mirror address is still:
```
GET /v1/hello
```
**So the URI rewritten in `proxy-rewrite` does not actually take effect for
`proxy-mirror`. (I have overridden the proxy-rewrite priority via
`_meta.priority` and it will be executed first)**
### Expected Behavior
The modified URI in `proxy-rewrite` will take effect for `proxy-mirror`.
### Error Logs
_No response_
### Steps to Reproduce
1. Create a route by referring to the route configuration in the current
behavior.
2. Request API
3. Check mirror service log
Explanation of reasons:
`proxy-rewrite` gets the URI from `ctx.var.uri`, writes it to the
`upstream_uri` variable, and subsequently uses that variable instead of the
original `uri` when forwarding upstream. `proxy-mirror` does not take this into
account and uses the original `uri` variable directly. I think it should behave
in such a way that the `uri` is used first and the `upstream_uri` is used when
the value does not match the `upstream_uri`.
### Environment
- APISIX version (run `apisix version`): 2.15.0
--
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]