Istio by default drop hostname in "location" header of a 301 response from microservice

Hello,

We have an API which will return dynamic 301 response to an external URL.

  • The incoming URL is like

${our_host}/downloads/${dynamic_path}

  • The response header “location” will be like:

Location: ${external_site}/a/b/${dynamic_path}

  • However, Istio will drop ${external_site} and /a/b in the final response returned to client side, e.g. the header will actually be:

Location: ${dynamic_path}

I have defined VirtualService for the ${external_site}. But it seems that Istio still doesn’t allow it.
The HTTPRedirect configuration doesn’t fit our need, since:

  • We have some business logic before sending 301 response
  • It only support static path replacement

I found several topics regarding redirection, but they all talk about redirect to a static external URL.

Could anyone help? Thanks in advance.

OK. I finally found the root cause. It’s due to a configuration mistake, not related to Istio :slight_smile: