我先描述我遇到的情况:nodejs后端,设置:app.all('*', function(req, res, next) {
console.log("appuse");
res.header("Access-Control-Allow-Origin","*");
res.header("Access-Control-Allow-Headers","Origin, Accept-Language, Accept-Encoding,X-Forwarded-For,
Connection, Accept, User-Agent, Host, Referer, Cookie, Content-Type, Cache-Control,*");
res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
res.header("Access-Control-Allow-Credentials",true);
res.header("X-Powered-By",' 3.2.1');
res.header("Content-Type", "application/json;charset=utf-8");
next();
});然后前端ajax请求后端,后端会返回set-cookieset-cookie:connect.sid=s%3ACOrynUfg9BleXlivy2GWX2n6gYzSnHoP.lX51TZD1YazMhcDJFTdqwPjN6pL7q1dcAhCEElVRGxQ;
Path=/; Expires=Sun, 30 Oct 2016 16:15:03 GMT; HttpOnly像上面那样?。但是问题来了。。。浏览器并没有自己设置cookie,之后发送请求的时候也没有cookie。查了半天,是因为跨域,放在同一个域下则问题解决,那么我现在想知道。。。如和在这种跨域的情况下让浏览器设置cookie之后发送 cookie?谢谢~
添加回答
举报
0/150
提交
取消