问题
A developer of a backend to which I am connecting is assuring me that when he sends a cookie in set-cookie
header that the browser should automatically save the cookie and send it back with following requests.
Does Angular 2 block cookies from being sent?
Since backend and frontend are both running on localhost, does them being on different ports block cookies from being sent with the requests?
回答1:
With a different port it's a CORS request. Set on the client
xhr.withCredentials = true
See also
- Angular 2 Http request does not send credentials
- Angular2 replacement of $httpProvider.defaults.withCredentials
On the server
Access-Control-Allow-Credentials: true
http://www.html5rocks.com/en/tutorials/cors/?redirect_from_locale=de
来源:https://stackoverflow.com/questions/34709964/does-angular-2-application-block-cookies-from-being-stored-by-default