我需要在 WildFly20 服务器响应上将相同的站点 cookie 属性设置为“严格”。我需要通过服务器配置来完成此操作。有什么帮助吗?
JMart 的答案是正确的,但需要将文件添加到您的网络应用程序(undertow-handlers.conf
)。使用 WildFly 19.1 (WFLY-13003)及以上您可以在 WildFly 中配置此功能standalone.xml
如下:
<subsystem xmlns="urn:jboss:domain:undertow:12.0" ...>
<server name="default-server">
...
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<http-invoker http-authentication-factory="application-http-authentication"/>
<!-- add the filter defined below -->
<filter-ref name="samesite-cookie"/>
</host>
</server>
...
<filters>
<!-- configure samesite handler -->
<expression-filter name="samesite-cookie" expression="samesite-cookie(mode=strict)"/>
</filters>
</subsystem>
这可以通过 WildFly 的 CLI 界面执行以下命令来实现:
/subsystem=undertow/configuration=filter/expression-filter=samesite-cookie:add(expression="samesite-cookie(mode=strict)")
/subsystem=undertow/server=default-server/host=default-host/filter-ref=samesite-cookie:add
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)