问题
How can I make the connect.sid cookie itself only a session cookie instead of a persistent one?
I unsuccessfully tried
app.use(express.session({cookie: { path: '/', httpOnly: true}, secret:'eeuqram'}));
But the cookie still had the expiration timestamp.
回答1:
app.use(express.session({cookie: { path: '/', httpOnly: true, maxAge: null}, secret:'eeuqram'}));
The above worked. So by setting maxAge to be null, I did manage expressjs to use session cookies. Phew.
来源:https://stackoverflow.com/questions/8842389/node-js-express-js-session-management-cookie-to-be-session-cookie