I'm using express and redis to keep the session live on my system. I having some problems to set the maxAge on the sessionCookie. By the default I read that is 24hrs, but that's a long time to keep it live. I would like to set like 30 min and then logout the user, I changed for 1min to see if it works but nothing happens, the user still logged.
This is my session function:
module.exports.initSession = function(app, db) {
app.use(session({
saveUninitialized: true,
resave: false,
secret: config.sessionSecret,
cookie: {
maxAge: 30*10000,
httpOnly: true,
secure: Boolean(process.env.ssl) || true
},
key: config.sessionKey,
store: new RedisStore({
host: config.redis.host || 'localhost',
port: config.redis.port || 6379,
db: config.redis.database || 0,
pass: config.redis.password || ''
})
}));
};
I also tried using ttl instead of maxAge but I get the same result. What could it be?
via Ellebkey
No comments:
Post a Comment