HOST_NAME bindingRSS

2 replies

Last post Jul 14, 2019 08:47 PM by Chris Becke

  • HOST_NAME binding

    Jul 12, 2019 07:20 AM|bijux|LINK

    Hi,

    I've an application behind ARR with 2 IIS servers in the pool. But the application requires to be accessed by it's own hostname. Meaning if we access it by www.condoso.com, then host header should be changed to server1.mysite.com and server2.mysite.com to the respective servers. How do I do that? And how can I verify if the host header has been changed from the IIS logs?

    Thanks

  • Re: HOST_NAME binding

    Jul 12, 2019 01:45 PM|lextm|LINK

    https://stackoverflow.com/questions/14841986/iis-aar-url-rewrite-for-reverse-proxy-how-to-send-http-host 

    You should set preserveHostHeader to false. To verify host headers, use a tool like Wireshark.

    Lex Li
    https://lextudio.com
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: HOST_NAME binding

    Jul 14, 2019 08:47 PM|Chris Becke|LINK

    There are two ways of dealing with this: Let ARR fill in the HOST header, or supply it yourself.

    There is a single, server-wide setting for ADD: preserveHostHeaders, that does not have a setting in the ARR GUI but if you open up the IIS Manager's Configuratrion editor for your server you can find the proxy settings under system.webServer.proxy

    Typically it defaults to false, which causes ARR to re-write the host its routing to, set it to true and it passes through www.condoso.com

    As Ive always encountered this setting as false by default, then

    • its been enabled for some purpose on your server, and disabling it might break that application.
    • it was enabled by accident and you can safely disable it / Im wrong about the default being false.
    • its already false, and ARR isn't routing to the "correct" server names.

    In the case that it must remain on, then you might want to try adding ARR rules that explicitly set the HTTP header. In the specific ARR rules for the site:

    1. Ensure that "HTTP_HOST" has been added as a server variable (this is before any rules screen).
    2. You can then add, to an incoming rule, a Server Variable rule that sets HTTP_HOST to a specific value. You seem to be routing to a web farm though so that won't work as you won't know which of Server1, Server2 etc ARR is going to pick. In which case, maybe it would be easier to disable perserveHostHeaders and use HTTP_HOST server variables to set it explicitly for the routes that require it.

    In the case that ARR is not setting the correct server name: If its a web farm I'd start by checking that the web farm is set up with the servers by their names, not by ip's or short hostnames.