title: IIS AAR - URL Rewrite for reverse proxy - how to send HTTP_HOST
body: <p>Trying to use AAR as a reverse proxy in front of several back end IIS servers.</p>
  
  <ul>
  <li><p>One public ip address assigned to the server running IIS/AAR</p></li>
  <li><p>Then outbound URL rewrite rules are setup to redirect to one of
  several back end servers depending on hostname.</p></li>
  </ul>
  
  <p>Works somewhat, but always returns the back end servers default site (not the one mapped to a hostname) so it looks like the host name (HTTP_HOST) is not getting passed from the proxy server to the back end server.</p>
  
  <p><em>(I've verified bypassing the reverse proxy by editing hosts and the back end server returns the correct site bound to the host header)</em></p>
  
  <p>This is an example of the rule (192.168.0.99 is the internal server, site.myco.com is the hostname)</p>
  
  <pre><code>    &lt;rewrite&gt;
          &lt;rules&gt;
              &lt;rule name="ReverseProxyInboundRule1" stopProcessing="true"&gt;
                  &lt;match url="(.*)" /&gt;
                  &lt;action type="Rewrite" url="http://192.168.1.99/{R:1}" /&gt;                   
              &lt;/rule&gt;
          &lt;/rules&gt;
      &lt;/rewrite&gt;
  </code></pre>
  
  <p>Have tried putting sever variables so</p>
  
  <pre><code>    &lt;!-- Guessing server.myco.com is hard coded --&gt;
      &lt;serverVariables&gt;
          &lt;set name="HTTP_HOST" value="server.myco.com" /&gt;
      &lt;/serverVariables&gt;
  
      &lt;!-- Guessing picked up dynamically from incoming request host header --&gt;
      &lt;serverVariables&gt;
          &lt;set name="HTTP_HOST" value="{HTTP_HOST}" /&gt;
      &lt;/serverVariables&gt;
  </code></pre>
  
  <p>But alas always returns the default binding - any ideas?</p>