The Mysterious ARR Server Farm to URL Rewrite link

Application Request Routing (ARR) is a reverse proxy plug-in for IIS7+ that does many things, including functioning as a load balancer.  For this post, I’m assuming that you already have an understanding of ARR. 

Today I wanted to find out how the mysterious link between ARR and URL Rewrite is maintained.  Let me explain…

ARR is unique in that it doesn’t work by itself.  It sits on top of IIS7 and uses URL Rewrite.  As a result, ARR depends on URL Rewrite to ‘catch’ the traffic and redirect it to an ARR Server Farm.

As the last step of creating a new Server Farm, ARR will prompt you with the following:

image

If you accept the prompt, it will create a URL Rewrite rule for you.  If you say ‘No’, then you’re on your own to create a URL Rewrite rule.

When you say ‘Yes’, the Server Farm’s checkbox for “Use URL Rewrite to inspect incoming requests” will be checked.  See the following screenshot.

image

However, I’m not a fan of this auto-rule.  The problem is that if I make any changes to the URL Rewrite rule, which I always do, and then make the wrong change in ARR, it will blow away my settings.  So, I prefer to create my own rule and manage it myself.

Since I had some old rules that were managed by ARR, I wanted to update them so that they were no longer managed that way. 

I took a look at a config in applicationHost.config to try to find out what property would bind the two together.  I assumed that there would be a property on the ServerFarm called something like urlRewriteRuleName that would serve as the link between ARR and URL Rewrite.  I found no such property. 

After a bit of testing, I found that the name of the URL Rewrite rule is the only link between ARR and URL Rewrite.  I wouldn’t have guessed.  The URL Rewrite rule needs to be exactly ARR_{ServerFarm Name}_loadBalance, although it’s not case sensitive.

Consider the following auto-created URL Rewrite rule:

image

And, the link between ARR and URL Rewrite exists:

image

Now, as soon as I rename that to anything else, for example, site.com ARR Binding, the link between ARR and URL Rewrite is broken.

image

image

To be certain of the relationship, I renamed it back again and sure enough, the relationship was reestablished.

Why is this important?  It’s only important if you want to decouple the relationship between ARR the URL Rewrite rule, but if you want to do so, the best way to do that is to rename the URL Rewrite rule.  If you uncheck the “Use URL Rewrite to inspect incoming requests” checkbox, it will delete your rule for you without prompting. 

Conclusion

The mysterious link between ARR and URL Rewrite only exists through the ARR Rule name.  If you want to break the link, simply rename the URL Rewrite rule.  It’s completely safe to do so, and, in my opinion, this is a rule that you should manage yourself anyway. 

1 Comment

  • For the record, I bevliee that the Header name must be capitalized, at least I had this issue. return ApexPages.CurrentPage().getHeaders().get( Host');returned cs3.salesforce.com';return ApexPages.CurrentPage().getHeaders().get( host');returned ;Thanks Osama! I met you years ago, but headed off to India for a long while and have been out of touch Bergen

Comments have been disabled for this content.