Node.js 使用www和非www url的快速会话
我目前将mySite.com和www.mySite.com解析到同一台服务器。我在会话选项中使用什么路径设置来确保我只创建一个可以在这两个URL之间“共享”的会话Node.js 使用www和非www url的快速会话,node.js,session,express,Node.js,Session,Express,我目前将mySite.com和www.mySite.com解析到同一台服务器。我在会话选项中使用什么路径设置来确保我只创建一个可以在这两个URL之间“共享”的会话 app.use ( session ( { store : new RedisStoreSession(), secret: 'keyboardCat', cookie: { maxAge: 3.156e+10 }, path: '/' //this is the default - i'm not
app.use ( session ( {
store : new RedisStoreSession(),
secret: 'keyboardCat',
cookie: { maxAge: 3.156e+10 },
path: '/' //this is the default - i'm not setting anything yet
} ) )
您可以在
cookie
中设置带前导
的domain
参数,以允许所有子域(包括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
} ) )