url-rewritinghttp-headersiis-8coldfusion-11server-variables

Server variables in outbound rules always show /jakarta/isapi_redirect.dll rather than actual path


I'm running ColdFusion 11 on Windows 2012/IIS8 and am trying to set up URL writing in IIS with an outbound rule to allow a server variable to be added if the URL matches a certain regular expression:

<outboundRules>
    <rule name="Add header for .ext files" patternSyntax="Wildcard">
        <match serverVariable="RESPONSE_The_Url" pattern="*" />
        <conditions>
            <add input="{REQUEST_URI}" pattern="\.ext$" negate="true" />
        </conditions>
        <action type="Rewrite" value="{REQUEST_URI}" />
    </rule>
</outboundRules>

The rule was always matching the (negated) condition and added the header with a value of '/jakarta/isapi_redirect.dll' I've tried a number of other server variables, but can't find a single one which outputs the path instead of /jakarta/isapi_redirect.dll.

I believe this is something to to with the interaction between IIS and the ColdFusion connector, but can't find any advice on how to resolve this. Is there a way I can correctly get the URL relating to the request in this rule, or some other way I can add a response header only in certain cases?


Solution

  • The ONLY way I've been able to work around this, is to create an Inbound rule that saves the original {REQUEST_URI} value to a custom server variable called HTTP_X_ORIGINAL_URL. This guide shows how to do this.

    NOTE: If you follow the guide and name the custom server variable ORIGINAL_URL, it WILL BE BLANK in your outbound rule. I guess the jakarta ISAPI filter will only forward server variables that begin with HTTP_X.