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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b41748-40b20.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b41748-40b20.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?