Issue description
Use-case
To test a new version of my endpoint, I want to use the proxy-mirror plugin.
The incoming request is /v1/hello. I'm using the proxy-rewrite plugin to rewrite the path to /hello before sending it to the upstream. However, the priority of proxy-rewrite is 1008; the priority of proxy-mirror 1010.
For this reason, the mirroring is first applied, sending /v1/hello to the mirror host, and only then is the rewrite applied, sending /hello to the nominal upstream. The mirror returns 404, as it doesn't know about v1. I need the opposite, first rewrite, then mirror.
Alternative solutions
-
Change the respective priority of proxy-mirror and proxy-rewrite to execute rewrite before mirror.
Pro: easy fix
Cons:
- Breaking change
- Some users may want to keep the current order
-
Move the ordering to configuration. Instead of having the priority in the source code, make it a runtime concern.
Pro: very flexible
Cons:
- Breaking change
- Require configuring the order, even if the current one fits
-
Allow to override default order. Keep the default priority in the source code, but allows overriding it in configuration
Pro:
- Very flexible
- Compatible with existing usage
Con: design and development effort
Issue description
Use-case
To test a new version of my endpoint, I want to use the proxy-mirror plugin.
The incoming request is
/v1/hello. I'm using the proxy-rewrite plugin to rewrite the path to/hellobefore sending it to the upstream. However, the priority ofproxy-rewriteis 1008; the priority of proxy-mirror 1010.For this reason, the mirroring is first applied, sending
/v1/helloto the mirror host, and only then is the rewrite applied, sending/helloto the nominal upstream. The mirror returns 404, as it doesn't know aboutv1. I need the opposite, first rewrite, then mirror.Alternative solutions
Change the respective priority of
proxy-mirrorandproxy-rewriteto execute rewrite before mirror.Pro: easy fix
Cons:
Move the ordering to configuration. Instead of having the priority in the source code, make it a runtime concern.
Pro: very flexible
Cons:
Allow to override default order. Keep the default priority in the source code, but allows overriding it in configuration
Pro:
Con: design and development effort