jeudi 13 août 2015

Using ARR how do you rewrite a url if a cookie is missing?

I know I can rewrite a url based on values from a cookie using the {HTTP_COOKIE} variable in the conditions part of the rule. This rule grabs a cookie called ServerProxy and does a rewrite to that server url.

    <rule name="SendTrafficToServerProxyCookieValue" stopProcessing="true">
        <match url="(.*)" />
        <action type="Rewrite" url="http://{C:1}/{R:0}" />
        <conditions>
            <add input="{HTTP_COOKIE}" pattern="ServerProxy=(.*)" />
        </conditions>
    </rule>

If the ServerProxy cookie is absent or unset I would like to direct the traffic to an authentication server called authenticate.app. How do I write a rewrite rule that will do that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire