根据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
标头?