我目前将mySite.com和www.mySite.com解析为同一台服务器。我在会话选项中使用什么路径设置,以确保我只创建一个可以共享"这两个网址之间?
app.use ( session ( {
store : new RedisStoreSession(),
secret: 'keyboardCat',
cookie: { maxAge: 3.156e+10 },
path: '/' //this is the default - i'm not setting anything yet
} ) )
答案 0 :(得分:1)
您可以在domain
中使用前导cookie
设置.
参数,以允许所有子域名(包括www)的Cookie:
app.use ( session ( {
store : new RedisStoreSession(),
secret: 'keyboardCat',
cookie: { maxAge: 3.156e+10, domain: '.example.org' },
path: '/' //this is the default - i'm not setting anything yet
} ) )