将其存储在默认情况下是否角2应用程序块饼干? [英] Does Angular 2 application block cookies from being stored by default?

查看:118
本文介绍了将其存储在默认情况下是否角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 =德

这篇关于将其存储在默认情况下是否角2应用程序块饼干?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆