I'm having trouble with setting up a reverse proxy outbound URL redirect in IIS 7 with ARR. The domain has 2 inbound URL rewrites and 1 outbound URL rewrite. The inbound ones work fine and I haven't seen any problems with them.
However the outbound redirect seems to crash the application pool every time it is enabled. And it will keep crashing until I disable the outbound rule. I think it might be some kind of loop in my redirects but I'm not sure. I'm not too familiar with regex myself and I haven't been able to find much from searching online.
Here are the 2 inbound redirects that work:
<rule name="Rule1" enabled="true" stopProcessing="false">
<match url="^blog/$" />
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="0" />
<set name="HTTP_X_FORWARDED_HOST" value="domain.com" />
</serverVariables>
<action type="Rewrite" url="http://blog.domain.com" appendQueryString="True" />
</rule>
<rule name="Rule2" enabled="true" stopProcessing="false">
<match url="^blog/(.*)" />
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="0" />
<set name="HTTP_X_FORWARDED_HOST" value="domain.com" />
<set name="HTTP_X_FORWARDED_FOR" value="{REMOTE_ADDR}" />
</serverVariables>
<action type="Rewrite" url="http://blog.domain.com/blog/{R:1}" appendQueryString="True" />
</rule>
And here is the outbound rule that causes the app pool to crash when it is enabled:
<outboundRules rewriteBeforeCache="true">
<rule name="outRule1" preCondition="isHtml" enabled="false" stopProcessing="false">
<match filterByTags="A" pattern="^http(s)?://blog.domain.com/blog/(.*)" />
<action type="Rewrite" value="http{R:1}://www.domain.com/blog/{R:2}" />
<conditions logicalGrouping="MatchAll">
</conditions>
</rule>
<preConditions>
<preCondition name="isHtml">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
Any help is much appreciated.
Best Answer
You will likely need to set
rewriteBeforeCache
to false for your outbound rulesPaul