将其存储在默认情况下是否角2应用程序块饼干?
问题描述:
后端的开发人员到我连接是确保我,当他送在的Set-Cookie
头一个cookie的浏览器应该自动保存cookie,并发送它带回以下请求。
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.
请问角2块饼干被发送?
Does Angular 2 block cookies from being sent?
由于后端和前端都在本地主机上运行的,他们确实是在不同的端口阻止cookies从请求发送?
Since backend and frontend are both running on localhost, does them being on different ports block cookies from being sent with the requests?
答
通过不同的端口这是一个CORS请求。
组
在客户端上
With a different port it's a CORS request. Set on the client
xhr.withCredentials = true
另请参见
- Angular 2 Http request does not send credentials
- Angular2 replacement of $httpProvider.defaults.withCredentials
在服务器
Access-Control-Allow-Credentials: true
http://www.html5rocks.com/en/tutorials/cors /?redirect_from_locale =德