Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the session expire after a browser close in node.js with express?

I am using

req.session.cookie.maxAge = 14 * 24 * 3600 * 1000 : 0

to let the session expire after two weeks. but now I want to make it expire after a browser close. Is there any way to do it?

like image 516
Tomey Avatar asked Aug 09 '11 06:08

Tomey


1 Answers

From the connect session middleware docs: "we can set req.session.cookie.expires to false to enable the cookie to remain for only the duration of the user-agent."

like image 153
Peter Lyons Avatar answered Sep 30 '22 14:09

Peter Lyons