【发布时间】:2026-01-06 16:05:02
【问题描述】:
我见过很多 IIS URL Rewrite 的例子:
<!-- reference: https://im5tu.io/article/2017/06/ensuring-samesite-cookies-with-url-rewrite/ -->
<rewrite>
<outboundRules>
<rule name="Ensure samesite Cookies" preCondition="Missing samesite cookie">
<match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" />
<action type="Rewrite" value="{R:0}; SameSite=strict" />
</rule>
<preConditions>
<preCondition name="Missing samesite cookie">
<!-- Dont remove the first line here, it does do stuff! -->
<add input="{RESPONSE_Set_Cookie}" pattern="." />
<add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=strict" negate="true" />
</preCondition>
</preconditions>
</outboundRules>
</rewrite>
有人知道为什么<add input="{RESPONSE_Set_Cookie}" pattern="." /> 这行是必要的吗?
我尝试在 Google 上搜索,但没有找到答案。
【问题讨论】:
标签: asp.net asp.net-mvc iis