asp.net - 如何通过 Web.Config 在 cookie 中添加 SameSite:none
问题描述
我正在尝试通过 web.config 在我们所有的 cookie 中添加相同的站点:无。我使用重写规则尝试了以下操作,但无济于事:
<outboundRules>
<rule name="Add SameSite None">
<match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="true" />
<action type="Rewrite" value="{R:0}; SameSite=none" />
</outboundRules>
解决方案
尝试以下操作:
<rewrite>
<outboundRules>
<rule name="Add SameSite" preCondition="No SameSite">
<match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" />
<action type="Rewrite" value="{R:0}; SameSite=none" />
<conditions>
</conditions>
</rule>
<preConditions>
<preCondition name="No SameSite">
<add input="{RESPONSE_Set_Cookie}" pattern="." />
<add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=none" negate="true" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
推荐阅读
- php - 更改 Laravel 路由时丢失身份验证
- oauth-2.0 - zuul网关使用keycloak发送错误的redirect_uri
- java - 如何使用展开列表值来指定顶点?
- linux - docker 错误:找不到满足要求 apturl==0.5.2 的版本
- android - 无法解析符号'Paint' android studio
- javascript - Lottie 背景在加载时改变了颜色 (expo)
- excel - 隐藏 Excel 图表的零值数据标签(带有类别名称)
- common-lisp - 寻找允许对列表进行自定义格式化的格式字符串
- javascript - 在javascript中的数组内映射对象?
- nginx - nginx ingress 是如何处理路由规则的?