From f7a4f8f8c2ec5fb138e89f9f87309d784b41af8a Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Tue, 5 Jul 2016 16:06:18 +0800 Subject: [PATCH] Add rolling option on session to reset maxAge on every response to extend session life --- app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index b8bb316d..ec411be5 100644 --- a/app.js +++ b/app.js @@ -100,9 +100,10 @@ app.use(session({ secret: config.sessionsecret, resave: false, //don't save session if unmodified saveUninitialized: true, //always create session to ensure the origin + rolling: true, // reset maxAge on every response cookie: { maxAge: config.sessionlife, - expires: new Date(Date.now() + config.sessionlife), + expires: new Date(Date.now() + config.sessionlife) }, store: sessionStore }));