Currently I am building a application using AngularJS 1.6 (http://localhost:8000), and Spring boot (http://localhost:8080). When the user log in, the spring boot api will add a cookie in the response, and I can see the cookie in the browser.
Then in another request to get the user, my backend code use
httpServletRequest.getCookies()
to get the cookie, but it always returns null.
When I used jsp and spring boot, it works well. So I am wondering if it is a cross domain issue.
In the backend, I already added the configuration:
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With, remember-me");
Can anyone give me some suggestions?
Thanks, Peter