According to this answer, for redirecting a mobile user to a mobile site you should add the HTTP header-
Vary: user-agent
I'm using IIS URL Rewrite module, with a rule like this-
<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>
How would I set the vary
header in this response?