My problem is: browser doesn't save the cookie from the Set-Cookie header.
I have the frontend (Angular2) that was deployed locally on my desktop. Backend on the staging server, so interaction is over the CORS.
What I'm getting in the request with the Set-Cookie header:
HTTP/1.1 200 OK
Date: Tue, 08 Aug 2017 11:00:03 GMT
Server: .....
Access-Control-Allow-Origin: http://localhost:4200
Access-Control-Allow-Credentials: true
Content-Type: application/json
Content-Length: 39
Set-Cookie: session=.........; Path=/
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
I'm sending the following request after I'm getting the answer above:
GET /api/..... HTTP/1.1
Host: ...{some url}...
Connection: keep-alive
Origin: http://localhost:4200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Content-Type: application/json
Accept: application/json, text/plain, */*
withCredentials: true
Referer: http://localhost:4200/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8,ru;q=0.6,uk;q=0.4
As you can see, there are no cookies there. Also, I can't see them in the external app (Chrome addon), in the JS console and in the web-console in the Application section. So cookies are definitely not saved by the browser.
My question is: where is the problem? Is it something wrong with my headers/whatever else, or is it the backend issue with the headers? Where can the problem be?
About the duplicating answers - as you will be able to see, I tried the answers that I was able to found here in the other topics, but they didn't solve my problem.