In the projects separated from the front and back ends, the returned cookie is empty, and the sessionid received by each call to the API is different.

the front end is written in angular, and the session, that can be received from the background is saved in the cookie ($cookies.put ("jsessonid", response.data.sessionId);),) can be read normally, but the server cannot receive it.
every time the interface is called, a new session, headache is returned!
has also considered the problem of cross-domain, which is reported by adding $httpProvider.defaults.withCredentials = true; browser, but the backend says it has little to do with this (- sharpsad)
. Do you want to add cookie to the request header? Get down on your knees and beg the boss to answer my doubts! Thank you very much

Mar.10,2021

first of all, if you want to cooperate with cookie, in the case of cross-domain, you must configure

withCredentials = true

after configuration, an error in the same origin policy will be reported. The solution is to specify

.
res.setHeader('Access-Control-Allow-Origin','http://172.19.0.215:3333');

Note that when xhr.withCredentials = true is configured, the response header information Access-Control-Allow-Origin, must be added to the backend and the domain name must be specified, not *. The node configuration code used in the current example:

you can refer to my previous related article ajax withCredentials usage


try adding the following code to options of request:

  

Let the backend send you sessionid, request parameters with sessionid to retrieve the previous session storage information

Menu