IIS7.5 Outbound Rule for lower case URLs in <a href="...">

Posted by Quog on Server Fault See other posts from Server Fault or by Quog
Published on 2011-02-03T11:07:51Z Indexed on 2011/02/07 15:27 UTC
Read the original article Hit count: 574

Filed under:
|
|
|
|

Hi,

I know how to canonicalise the case of URLs on incoming request to IIS7.5, in fact, there's a built in rule template to start from. But how about outbound (without changing the code)?

This is where I got to so far:

    <outboundRules>
        <rule name="Outbound lowercase" preCondition="IsHTML" enabled="true">
            <match filterByTags="A" pattern="[A-Z]" ignoreCase="false" />
            <action type="Rewrite" value="{ToLower:{R:0}}" />
        </rule>
        <preConditions>
            <preCondition name="IsHTML">
                <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
            </preCondition>
        </preConditions>
    </outboundRules>

However, IIS barfs on the action with a 500 implying an invalid web.config, probably on the {ToLower:XXXX} which I stole from the MS-supplied inbound rule template.

Anyone know how to do this?

Anyone know where the options are fully documented (my GoogleNinja skills failed me: I found this but "Specifies value syntax for the rule. This element is available only for the Rewrite action type" is not really comprehensive).

Thanks, Damian

© Server Fault or respective owner

Related posts about iis

Related posts about iis7