[英]set-cookie field is present, however is not set in Resources/Application tab of the browser
I got a cookie being set in the response header, however my browser doesn't store the cookie. 我在响应标头中设置了一个cookie,但是我的浏览器未存储该cookie。 The front-/back-end components run on localhost:8080/8082 respectively.
前端/后端组件分别在localhost:8080/8082上运行。
Using node
v5+, express
v4+ and tried both connect-mongo
/ connect-redis
使用
node
v5 +, express
v4 +,并尝试使用connect-mongo
/ connect-redis
Chrome v. 52.0.2743.82
Even though Chrome is supposed to play nicely with cookies from domain=localhost
for quite some time now, I still tried to create a PTR in the /etc/hosts
file like 127.0.0.1 local.com
, no difference. 尽管Chrome应该可以很好地与
domain=localhost
cookie一起很好地播放,但我仍然尝试在/etc/hosts
文件(如127.0.0.1 local.com
创建PTR,没有区别。
Here is the set of header fields that I see in the response: 这是我在响应中看到的标头字段集:
I tried disabling httpOnly
flag, still the same. 我尝试禁用
httpOnly
标志,仍然一样。
Figured it out after reading the following article, this section in particular . 阅读以下文章, 尤其是本节后,请先弄清楚。 Kudos to Mozilla folks!
对Mozilla员工表示敬意!
On the node side I added: 在节点一侧,我添加了:
res.header('Access-Control-Allow-Credentials', 'true');
In the axios.pos I added the following key:value pair in the config part: 在axios.pos中,我在配置部分添加了以下key:value对:
{withCredentials: true}
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.