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 -H "Host:"

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

  from = "/*"
  to = ""
  status = 200
  force = false # COMMENT: ensure that we always redirect
  headers = {X-From = "Netlify", Host = ""}

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 @Scott. 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, but the Host header will be
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:

I’m also wondering if the Host header can be set on a proxy redirect?

Have you read through the link I posted? That shows how you can set custom request headers on proxy redirect rules.

Yes I did and I see how to send custom headers but not set the Host header, a service I am using needs to see the host header have the same domain as my websites domain. When using a reverse proxy in Netlify, the host header becomes Netlify and doesn’t work to load the content from the 3rd party service.

Sorry for the disconnect - yes, I can confirm that you CANNOT set the Host header to a custom value when we proxy. It will ALWAYS be set to the hostname we connect to (the one specified in your proxy rule), since most web services (including Netlify when it is proxied to) require this to function correctly.

Hi @fool I wanted to clarify your answer. For this example:

What would you expect the ultimate “Host” value in the header to be? “Host”: “”?

Whoops! So sorry I missed this, @dot ! I’d expect:

No worries at all! Thanks for confirming my understanding :grinning: