The problem of axios carrying cookie across domains

when logging in, the backend
Set-Cookie:JSESSIONID=NmM4Yzk3OTQtZDE2Ni00NWQxLWIyYzAtYjRhN2UyNDA0MmEw; path=/; HttpOnly
but when sending a request with axios, it still does not bring cookie, and it is not possible to set withCredentials: true. I would like to ask you, how to troubleshoot and solve this problem?
clipboard.png
clipboard.png

May.12,2022

the people upstairs are all misleading people. The main purpose of cookie with the HttpOnly attribute set is to prevent XSS , so you cannot access it using the JavaScript Document.cookie attribute, XMLHttpRequest and fetch .

this kind of problem should refer to the RFC document:

https://tools.ietf.org/html/r...

this depends on what browser you can't use? Is it under chrome


response header Set-Cookie you should specify Domain
for example:
Set-Cookie:JSESSIONID=NmM4Yzk3OTQtZDE2Ni00NWQxLWIyYzAtYjRhN2UyNDA0MmEw; domain=codeshelper.com; path=/; HttpOnly


website domain name is a subdomain name of www.ceshi.com, if not, you can't set it up;
reference: https://codeshelper.com/a/11...

"
Menu