下面是我的 cookie 配置。这显示了我如何尝试设置 cookie 作为响应。
res.cookie(config.COOKIE_NAME, token,
{
httpOnly: true,
domain: 'localhost',
secure: false,
path: '/',
maxAge: 2 * 60 * 60 * 1000 ,
sameSite: 'lax',
}
);
localhost:3000
上运行,该 nodejs
位于 localhost:4200
proxy.conf.json
上运行res.header("Access-Control-Allow-Credentials", true); res.header("Access-Control-Allow-Origin", "*");
文件启用了代理。Channel:uuid:c956936a-77c9-48a6-9fa4-ef6efba13123;id=20;Link:495842;Action:http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/UpdateMessageState TrackingId:ded3f1a3-d96b-4f49-8ceb-46bf03791743_G4_B28, SystemTracker:net.tcp://10.0.0.35:21009/27/Runtime, Timestamp:2021-02-18T05:05:35 Channel:uuid:c956936a-77c9-48a6-9fa4-ef6efba13123;id=20;Link:495842;Action:http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/UpdateMessageState TrackingId:ded3f1a3-d96b-4f49-8ceb-46bf03791743_G4_B28, SystemTracker:net.tcp://10.0.0.35:21009/27/Runtime, Timestamp:2021-02-18T05:05:35