We’d like to start by saying this is not necessarily a bug.
Looking at the request middleware chain, the cors middleware is executed much earlier than the URL rewrite middleware. It’s the design just doing what it’s supposed to at that point - passthrough to the upstream, or handle the necessary response itself. As you’ve observed, with passthrough enabled, the request is passed on to the upstream defined in the target_url (proxy.target_url).
Taking insight from this, a way around this specific scenario would be to set the “my/service” upstream server as the target_url in the API definition, and then configure url rewrite, in such a way that it would catch everything else (everything other than match/me) and rewrite to whatever you initially had as the target_url.
But this might have its trouble if you need more than just the match/me rewrite with each rewrite going to a different upstream server.
Hope this helps.
Looking forward to your response.
We’d like to start by saying this is not necessarily a bug.
Bugs are defined by requirements/documentation, not by implementation!
CORS.options_passthrough: allow CORS OPTIONS preflight request to be proxied directly to upstream, without authentication and rest of checks.
This doesn’t say anything about skipping middleware.
Taking insight from this, a way around this specific scenario would be to set the “my/service” upstream server as the target_url in the API definition, and then configure url rewrite, in such a way that it would catch everything else (everything other than match/me) and rewrite to whatever you initially had as the target_url.
But this might have its trouble if you need more than just the match/me rewrite with each rewrite going to a different upstream server.
I don’t follow this at all. Note we have multiple URL rewrites