VirtualService rewrite prefix, but keep it in responses

Hello there! I’m facing an issue that I’m not sure if Istio should handle, or if I need to do something outside it, but here it goes:

I have a VirtualService with a rewrite rule (it removes the app name as the prefix), but if the app returns a 302 redirecting the call, Istio does not keep the prefix.

For example, if I call https://my.awesome.url/app-name/docs, the app returns a 302 pointing to /swagger-ui/index.html, then Istio tries to call https://my.awesome.url/swagger-ui/index.html instead of https://my.awesome.url/app-name/swagger-ui/index.html.

So my question is, is this achievable? Can the prefix be added back to URLs in the responses? Or did I misunderstand the rewrite functionality entirely?

Thank you in advance!