admin管理员组文章数量:1315252
I have frontend running at and backend at
.
In the Chrome Dev Tools under Network, I can see that when frontend calls , the response includes the following header:
set-cookie:
MY-COOKIE-NAME=mycookievalue; Max-Age=604800; Expires=Thu, 06 Feb 2025 08:00:49 GMT; Path=/foo; Secure; HTTPOnly; SameSite=None
I can't see the cookie in Chrome Dev Tools under Application > Cookies. It is also not getting sent in subsequent calls to .
When I call from Postman, it picks up the cookie and uses it in subsequent calls to
.
What is the reason for this?
I have frontend running at https://fe-qa.mydomain
and backend at https://qa.mydomain
.
In the Chrome Dev Tools under Network, I can see that when frontend calls https://qa.mydomain/foo/bar2
, the response includes the following header:
set-cookie:
MY-COOKIE-NAME=mycookievalue; Max-Age=604800; Expires=Thu, 06 Feb 2025 08:00:49 GMT; Path=/foo; Secure; HTTPOnly; SameSite=None
I can't see the cookie in Chrome Dev Tools under Application > Cookies. It is also not getting sent in subsequent calls to https://qa.mydomain/foo/bar2
.
When I call https://qa.mydomain/foo/bar1
from Postman, it picks up the cookie and uses it in subsequent calls to https://qa.mydomain/foo/bar2
.
What is the reason for this?
Share Improve this question asked Jan 30 at 8:10 jjrzjjrz 3791 gold badge6 silver badges14 bronze badges1 Answer
Reset to default 1Solution:
Ensure the frontend is configured to include credentials (cookies) in the request.
Example for fetch:
fetch('https://backend-api/endpoint', {
credentials: 'include'
});
Example for Axios:
axios.get('https://backend-api/endpoint', {
withCredentials: true
});
also ensure this header is set
Set Access-Control-Allow-Credentials: true
in the backend response.
本文标签: setcookieBrowser ignoring SetCookieStack Overflow
版权声明:本文标题:setcookie - Browser ignoring Set-Cookie - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741979012a2408289.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论