快速概览: 我在域名1打开我的网站。在页面内部,我加载了一个带有url的iframehttp://domain2/...
我一直在chrome上收到这个警告,它影响了我的网站:
A cookie associated with a cross-site resource at http://domain2 was set without the
SameSite
attribute. It has been blocked, as Chrome now only delivers cookies with cross-site requests if they are set withSameSite=None
andSecure
. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
我以前从未设置过cookie,所以我不知道cookie应该从哪里设置。我已经尝试在我的域2nginx配置中设置proxy_cookie_path
,但似乎不起作用:
location / {
proxy_cookie_path / "/; SameSite=None; Secure";
}
我还尝试添加了Set-Cookie
头,这似乎也不起作用:
location / {
...
add_header 'Set-Cookie' 'SameSite=None; Secure';
}
当我尝试第二种解决方案时,似乎从chrome上的响应中收到了标题,但chrome给出了以下警告:
请注意,域2也是我们的域,它有一个使用Flask框架的python后端。那么,我应该从python代码或javascript前端添加cookie吗
这真的令人沮丧
我在块{}和{}中使用了这个{},它工作了
跨站点资源共享-当请求通过同一域发送时,CORS是一个已知问题。您可以尝试使用已有的flask cors package来允许相同的原始请求
此外this问题和答案似乎与您的相关
相关问题 更多 >
编程相关推荐