如何使用IIS URL重写为移动重定向设置Vary HTTP标头?

时间:2013-01-23 12:52:07

标签: iis redirect mobile http-headers url-rewrite-module

根据this answer,要将移动用户重定向到移动网站,您应该添加HTTP标头 -

Vary: user-agent

我正在使用IIS URL Rewrite模块,其规则如下 -

<rule name="Production Mobile Rewrite 1" patternSyntax="ECMAScript" stopProcessing="true">
    <match url="(.*)" ignoreCase="true" negate="false" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" />
        <add input="{HTTP_HOST}" pattern="^www.example.com$" />
    </conditions>
    <action type="Redirect" url="http://m.example.com/{R:1}" appendQueryString="false" redirectType="Found" />
</rule>

如何在此响应中设置vary标头?

0 个答案:

没有答案