In IIS 8.5 I am using URL rewrite to forward the request to an external server (in server farm). The problem is that rewrite is adding the Host header to the request to the external server, which is causing that server to respond with an error. Testing manually with Postman, I can see that if I send a request to the external server with a Host header, I get the same error (even if value is blank). Removing the Host header will give a successful response.

How do I remove the Host header from the forwarded request to the external server?

I've seen questions and answers regarding removing the headers from the response. However these either are not applicable or dont work with respect to forwarded request headers.

  • 1
    The Host: header has been mandatory since 1999 when RFC 2616 defined HTTP 1.1 ... If "the presence of the Host header" breaks your server, that is what should be fixed, not IIS. - (Although I suspect that your problem might more accurately be that IIS does not set the correct Host: header and the target server needs a specific Host header to present the correct site ... ) – HBruijn Feb 1 at 8:52
  • Thanks.. The external target server is a commercial service and can't be changed. I'll have to come up with another way to create a forward proxy to it. – Matt Feb 1 at 18:28
  • Is there a way to change the Host: header in IIS when it forwards the request? – Matt Feb 5 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.