最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

重定向到新的子域并在重定向的子域上设置cookie

网站源码admin19浏览0评论

重定向到新的子域并在重定向的子域上设置cookie

重定向到新的子域并在重定向的子域上设置cookie

Express:4.x

NodeJS:12.x

a.example上,我有一个GET侦听器,该侦听器重定向到b.example,并在b.example上设置cookie。

app.get('/foo', (req, res) => {
    res.cookie('name', 'foo', { domain: '.example', path: '/', secure: true })
    res.cookie('age', '21', { domain: '.example', path: '/', secure: true })
    res.redirect(302, '');
})

但是在b.example中未设置任何cookie。我在这里想念什么?

回答如下:

好,所以我想出了答案。从domain中删除res.cookie选项是有效的。

发布评论

评论列表(0)

  1. 暂无评论