I am currently migrating a (working) website to the Windows Azure cloud but am having issues with the UrlRewrite module. The problem is the outbound rules cause an Internal Server Error - the site loads correctly if I disable the rules.
I have checked the order of the modules on the Azure server and it is exactly the same as my local machine and the hosting server. I have disabled static compression with the following line in my web.config:
<urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
Here is an example of the rewrite rule that is causing the issue:
<rule name="cdn rewrite" preCondition="text only">
<match filterByTags="Img" pattern="^/Images/(.*)$" />
<action type="Rewrite" value="http://cdn.website.com/{R:0}" />
</rule>
I also have the following precondition defined:
<preCondition name="text only">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/.+$" />
</preCondition>
Don't know if it's relevant or not but the site is MVC4 running inside and extra small 2008r2 instance (osFamily="2").
I have a workaround at the moment with Application Request Routing but I would rather have the URL rewritten as we don't plan on using the Azure CDN for the production site.
Anyone managed to get this working on Azure?
Edit - some more info:
The actual error (reported in firebug) says "NetworkError: 500 URL Rewrite Module Error. - http://website.cloudapp.net/"
There is nothing in the logs either in the event viewer or the actual log file relating to this issue.
Actually fixed it while typing this out - see below