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:
Requests to the upstream will be rewritten as:
But the request to the mirror address is still:
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
- Create a route by referring to the route configuration in the current behavior.
- Request API
- 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. If necessary we also need to modify the proxy-rewrite priority so that it takes precedence over proxy-mirror.
Environment
- APISIX version (run
apisix version): 2.15.0
Current Behavior
The route configuration (omitted some irrelevant content):
The client uses this URI to request:
Requests to the upstream will be rewritten as:
But the request to the mirror address is still:
So the URI rewritten in
proxy-rewritedoes not actually take effect forproxy-mirror. (I have overridden the proxy-rewrite priority via_meta.priorityand it will be executed first)Expected Behavior
The modified URI in
proxy-rewritewill take effect forproxy-mirror.Error Logs
No response
Steps to Reproduce
Explanation of reasons:
proxy-rewritegets the URI fromctx.var.uri, writes it to theupstream_urivariable, and subsequently uses that variable instead of the originaluriwhen forwarding upstream.proxy-mirrordoes not take this into account and uses the originalurivariable directly. I think it should behave in such a way that theuriis used first and theupstream_uriis used when the value does not match theupstream_uri. If necessary we also need to modify theproxy-rewritepriority so that it takes precedence overproxy-mirror.Environment
apisix version): 2.15.0