Cookies 在 safari 中有效,但在 chrome 或在本地主机上使用 nginx 的 mozilla 中无效

Cookies work in safari, but not in chrome or mozilla using nginx on localhost

我刚刚从使用 node 作为我的反向代理切换到 nginx,它破坏了我的 cookie 身份验证,即用户没有登录 mozilla 和 chrome,但在 safari 上仍然可以正常工作。有人可以帮我解决这个问题吗?

这是我的 nginx 反向代理设置:

server {
   listen       8080;
   server_name  localhost;

   location /api {
       proxy_set_header   X-Forwarded-For $remote_addr;
       proxy_set_header   Host $http_host;
       proxy_pass         http://127.0.0.1:3001;
   }

已通过添加凭据修复:'same-origin' 到我的提取 ajax 请求