문제

When making an ajax call to log a user in the response contains all my cookies but the JSESSIONID and ROUTEID cookies return with no domain. Doing the same call as a regular request returns the cookies with the correct domain. I can't seem to figure out why and searching seems to return no similar issues.

I use jQuery for my ajax call.

도움이 되었습니까?

해결책

had to add

xhrFields: {
    withCredentials: true
},

as an ajax param and

response.addHeader("Access-Control-Allow-Origin",
               request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");

as my response headers

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top