我很熟悉IIS和URL重写,但我刚刚得到了一个难倒我的任务。 我需要检查每个请求是否存在X-Forwarded-For HTTP头,并根据它的存在来redirect请求。
我怎样才能检查这个头?
尝试如下所示:
<rewrite> <rules> <rule name="RedirectBasedOnForwardedFor" patternSyntax="Wildcard" stopProcessing="true"> <match url="*" /> <conditions> <add input="{HTTP_X_Forwarded_For}" pattern="insert your pattern here" /> </condiations> <action type="Redirect" url="/newurl/" /> </rule> </rules> </rewrite>