后端是nodejs
设置了一个cookie
ctx.set('Access-Control-Allow-Origin', '*');
ctx.set('Set-Cookie','name=fromBackEnd;max-age=303003030');
ctx.set('Access-Control-Allow-Credentials', true);
在浏览器中打开网页
查看network里面有cookie的信息
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type, Content-Length, Authorization, Accept, X-Requested-With
Access-Control-Allow-Methods: PUT, POST, GET, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 553
Content-Type: application/json; charset=utf-8
Date: Tue, 19 Nov 2019 12:34:54 GMT
Set-Cookie: name=fromBackEnd;max-age=303003030
但是在application中没有这个cookie
而且在没有设置httponly的情况下 document.cookie里也没有这个cookie
为什么?
啥框架?express?koa?
我看这个写法有点像koa,koa的cookie设置需要使用
ctx.cookies
: