We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

IIS7 - ARR - Multiple websites on same server [Answered]RSS

3 replies

Last post Jun 17, 2010 01:10 AM by wonyoo

  • IIS7 - ARR - Multiple websites on same server

    Jun 15, 2010 12:47 PM|THK|LINK


     We are using ARR in a test environment. Currently we have added to separate websites (different hostname, same domain) on the server.

    Ex: test.domain.com and test2.domain.com


    We are attempting to send test.domain.com to webserver farm1 and test2.domain.com to webserver farm2.  However; when we attempt to connect to the second URL (test2.domain.com) it always routes us to webserver farm1.  When trying to see if we can make URL Rewrite rules on each website, the action of route to server farm is not there.


    Is this possible?

  • Re: IIS7 - ARR - Multiple websites on same server

    Jun 15, 2010 04:26 PM|Mark S. Rasmussen|LINK


    First of all, you don't need to create any websites but a default website that binds to all hostnames.

    Create two server farms, one called Farm1 and the other called Farm2, and set them up as you please. 

    Now go to the IIS level settings and enter the URL Rewrite module settings. Create two new blank rules called "test.domain.com" and "test2.domain.com" - the naming is purely for your own sake, they have no practical effect.

    Make sure they're set to use wildcards and that the matching pattern is "*". Now, the important thing is to add a "Condition" with an input of "{HTTP_HOST}" and set the pattern to "test.domain.com" for the first rule and "test2.domain.com" for the second rule accordingly. For each rule, make sure the action type is set to "Route to Server Farm" and that the matching server farm is chosen.

    This will make sure the rules match any URLs and thanks to the condition we setup, only one rule will match each domain name and route it to the related server farm.

    If you prefer the non-GUI way, here's how to setup the rewrite rules in the C:\Windows\System32\inetsrv\config\applicationHost.config file:

            <rule name="test.domain.com" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                <action type="Rewrite" url="http://Farm1/{R:0}" />
                    <add input="{HTTP_HOST}" pattern="test.domain.com" />
            <rule name="test2.domain.com" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                <action type="Rewrite" url="http://Farm2/{R:0}" />
                    <add input="{HTTP_HOST}" pattern="test2.domain.com" />

        <webFarm name="Farm1" enabled="true">
            <server address="learn.iis.net" enabled="true" />
        <webFarm name="Farm2" enabled="true">
            <server address="bing.com" enabled="true" />
                <add name="Microsoft.Web.Arr.HostNameRoundRobin" />
                <add name="Microsoft.Web.Arr.HostNameMemory" />

    In the above example I've setup Farm1 to proxy the learn.iis.net site and Farm2 to proxy bing.com. Thus if I setup test.domain.com and test2.domain.com to point to using the hosts file and I then access the URL test.domain.com in my browser, I'll basically browse learn.iis.net and likewise I'll browse bing.com using test2.domain.com.

    I decided to write a short blog post that's a bit easier to follow due to formatting: http://improve.dk/blog/2010/06/16/setting-up-multiple-iis-application-request-routing-farms-on-the-same-server

    - Mark

  • Re: IIS7 - ARR - Multiple websites on same server

    Jun 16, 2010 11:03 AM|THK|LINK

     Fantastic. That worked well.

    I have an additional question along the same lines.  Can we have multiple domains on the same server with different SSL Certs?

    host.domain1.com --> farm 1 (host1.domain1.com, host2.domain1.com)

    host.domain2.com --> farm 2 (host1.domain2.com, host2.domain2.com)

    and then: (Where the outside domain is diff then the proxied one)

     host.domain3.com --> farm 3 (host1.domain1.com, host2.domain1.com)

  • Re: IIS7 - ARR - Multiple websites on same server

    Jun 17, 2010 01:10 AM|wonyoo|LINK

    The short answer is, "yes you can", but it can be a bit more complicated.

    Whether the domain is the same or not, note that you will need to import the SSL cert on the ARR server(s) as the browsers are communicating directly with the ARR server(s) and not where it is being routed to (farms).   In this context, as you may know, you will need to have dedicated IP per SSL cert, as you will not be able to use host name binding with SSL (at least not on WS08/WS08 R2).   So provided that you have multiple dedicated IPs on the ARR server, you will be able to use multiple SSL certs (this is really no different from hosting multiple SSL sites on a regular IIS server, with/without ARR.)

    In addition, ARR has a feature called "SSL offloading".  This is a feature where the communications between the browsers and the ARR server(s) are encrypted using the SSL cert, but the communications between the ARR server(s) and the content servers are done in clear text.  The benefits are: 1) you have one central location to manage certs on ARR server and 2) your content servers - provided that you trust your environment - will not need to spend cycles on encrypting/decrypting.