Rewrite http request based on response location header



Make a request to Istio (1.0.6) proxy to upstream via virtual_service. Service is responding with header newuri , with httpStatus code ie 307 - I know that redirect should works by designe with 302 and location header. But I want to make a redirect handling based on http error. I tried using envoyFilters with lua but all features are related to stream handling (request/response headers mod) rather than rewrite or request forward .

So the request path looks like this:

  • client is making request ie curl http:// foo/ path
  • proxy is forwarding request to upstream
  • upstream is responding with custom header ie “newLocation: http:// blabla/ path2” as value
  • while header exist in response, proxy is doing new request to newLocation
  • client see response from the newLocation

Thanks for any help :wink: