Is there a way to capture part of the url in an outbound rule to use as value for the re-write?
Right now, I'm using a precondition, where I have an input with a pattern against the {REQUEST_URI}. I'd like to use a capture group from the request URI in the outbound rule that uses this precondition. I tried {C:1} but that didn't work.
Precondition:
<preCondition name="Html Response" logicalGrouping="MatchAll">
<add input="{REQUEST_URI}" pattern="myapp(.*)" />
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^(text/html)" />
</preCondition>
Outbound rule:
<rule name="ResponseRewriteRelative" preCondition="Html Response" stopProcessing="true">
<match filterByTags="A, Link" pattern="^/(.*)" />
<action type="Rewrite" value="{C:1}/{R:1}" />
</rule>
where {C:1} would be the capture group from precondition "myapp(.*)"
So, it'd go from http://myapp40.com to rewrite links in the response to something similar to 40/originalrelativelink
Thanks!
I just found out that you can add a condition to the outbound rule per se. Just answering here in case there's any other clueless person struggling with the rewrite rules :)
Rule would look something like: