Tip #36: Did you know... How to manage pilot or beta program for your site using Application Request Routing in IIS7.0?

Won't it be cool if you can target and route appropriate users of your site to your pilot/beta/new looking site based on user's profile. This may help you in managing select users who have previously signed for pilot program and redirect them to new looking web site and gather feedback. This is a very typical situation when your web site is evolving or going a major change. IIS7.0 Application Request Routing (ARR) module helps you achieve this. The other situation where this can help is to limit and manage the amount of traffic that is routed to pilot site. There can be numerous other scenarios like ones mentioned where ARR can assist but the focus of the tip will be to learn how to get this done through ARR. You can apply it to other related scenario too.

Let's say for example we would like to redirect all users who have .NET Framework 3.5 installed and are using the browser Internet Explorer to the pilot site. For achieving this using ARR, follow the below steps:

  • Launch IIS Manager.
  • Create a server farm named "pilotSiteServers" using this walkthrough. This server farm will represent the pilot/beta environment.
  • Create another server farm named "productionSiteServers" as above. This server farm will represent the production environment.
  • Select the server farm "pilotSiteServers". The following icons will be shown:

srv-farm

  • Double click on "Routing Rules".
  • Since this scenario involves multiple server farms with conditional matching of HTTP request headers, we will use URL Rewrite UI which exposes additional options. Click on "URL Rewrite" under "Advanced Routing".

adv

  • You will note that two rules are already there.

twoRules

  • These rules has to be changed. The order of rule is important. I will explain it in a while. For now, if ARR_productionSiteServers_loadbalance is above ARR_pilotSiteServers_loadbalance, change the order of the rules by using Move Up or Move Down after selecting the rule.
  • Select ARR_pilotSiteServers_loadbalance, and then click Edit... in the Actions pane.

edit

  • We need to define conditions now. Remember our aim is to "redirect all users who have .NET Framework 3.5 installed and using the browser Internet Explorer to the pilot site"

  • Click Add Conditions, and thenclick Add... .

    add

  • Enter {HTTP_USER_AGENT} as Condition input and *MSIE* as Pattern.  This condition checks to see if the client is using IE.

    add2

  • Add another condition to check for the .NET version.  Click Add... , and then enter {HTTP_USER_AGENT} as Condition input and *.NET CLR 3.5* as Pattern.

    add3

  • Finally, uncheck the "Stop processing of subsequent rules" checkbox, and then click "Apply" to save the changes.

    add4

  • Now let me answer why the order of rules mattered. This is because URL rewrite processes the rules in order when "Stop processing of subsequent rules" is unselected.  So in this case the first rule ARR_pilotSiteServers_loadbalance will be considered first.  This rule tries to match whether the client is using IE and has .NET Framework 3.5 installed.  If so, the requests are forwarded to the pilotSiteServers server farm.  Since the "Stop processing of subsequent rules" checkbox is unchecked, it will also process the second rule. This means the rule ARR_productionSiteServers_loadbalance will also get processed. This will route all other request to productionSiteServers server farm.

That's it, we are done. For details regarding pre-requisite and command line equivalent of the above URL Rewrite rules look here.

Don Raman
SDET, IIS Team