首页 > 解决方案 > symfony 5 samesite=none firefox

问题描述

使用 Synfony 5 时,我仅在 Firefox 上出现控制台错误,我到处寻找解决方案,但我在 symfony 问题上看到问题来自 Firefox,我想确定或找到解决方案。

控制台错误:

“sf_redirect” cookie 很快就会被拒绝,因为它的“SameSite”属性设置为“None”或无效值,并且它没有“secure”属性。要了解有关“SameSite”属性的更多信息,请参阅https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite
“sf_redirect”cookie 已被拒绝,因为它已经过期。

Symfony 5 框架.yaml

framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
#http_method_override: true

# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
    handler_id: null
    cookie_secure: auto
    cookie_samesite: lax

#esi: true
#fragments: true
php_errors:
    log: true

先感谢您。

标签: symfonyconsolecsrfsamesite

解决方案


CookieSameSite=None仅适用于Secure. 有关更多信息,您可以在此处查看。另外,如何在symfony中设置 cookie


推荐阅读