recaptcha samesite cookie错误与django 4.0.4
我在我的Django项目中包括了recaptcha v3,但面临此错误:
“指示是否在跨站点请求中发送cookie 指定其Samesite属性“
我尝试按照 django-检查cookie cookies' a>,甚至提到
一次
CSRF_COOKIE_SAMESITE = "random"
第
解决问题。代码>
然后我收到了一个更细微的错误 -
标记跨站点cookie是安全的,以便在跨站点上下文中设置它们
,我添加了csrf_cookie_secure = true
,根据 docs ,但它一无所获。我仍然面临完全相同的错误。我该如何解决?
I have included Recaptcha v3 in my Django project but am faced with this error:
"Indicate whether to send a cookie in a cross-site request by
specifying its SameSite attribute"
I have tried following the answer in Django - check cookies's "SameSite" attribute and even referred to the docs, but I haven't been able to solve the problem.
First, I entered
CSRF_COOKIE_SAMESITE = "random"
in settings.py to check if it would be recognized and cause an error and it did, so I changed it to
CSRF_COOKIE_SAMESITE = "none"
Then I received a more nuanced error -
Mark cross-site cookies as Secure to allow setting them in cross-site contexts
Next, I added CSRF_COOKIE_SECURE = True
as per the docs, but it achieves nothing. I still face the exact same error as with nothing at all. How can I solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就我目前的理解而言,不可能在非HTTPS网站上拥有安全的cookie。
To the extent of my current understanding, it is not possible to have secure cookies on a non-https website.