Frage

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.

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top