Can the Host header be defined on a redirect?

Hi, due to some redirection issues on the target website, I would like to set the Host header with a different subdomain than the one we’re actually connecting to. Exactly what you would do with:

curl -v https://website-old.xyz.com/ -H "Host: www.xyz.com"

I’ve tried setting it in the redirection rule but it doesn’t seem to work according to the server logs:

[[redirects]]
  from = "/*"
  to = "https://website-old.xyz.com/:splat"
  status = 200
  force = false # COMMENT: ensure that we always redirect
  headers = {X-From = "Netlify", Host = "www.xyz.com"}

Can you please help me understand if this is just totally unsupported or if there’s any other way I could do it?

Thank you!

Do you mean like this? :slight_smile:

That said, we don’t support proxying to us, just an FYI. :+1:

Thanks for the reply @Pieparker. If I understand correctly, I can use the _headers to adjust the response headers from Netlify. In this case, I’m not looking to set response headers. Instead, I would like the proxied request to include a different Host request header. That is, the HTTP connection is established using the resolved IP from website-old.xyz.com, but the Host header will be www.xyz.com.
Btw, the proxied request is not to a Netlify host but to another server we have with an old implementation of the website :slight_smile:

Like this: https://docs.netlify.com/routing/redirects/rewrites-proxies/#custom-headers-in-proxy-redirects?