Express and Redis sessions don't survive browser close

Viewed 1394

I am trying to get persistent sessions working using RedisStore but whenever i close the browser the session is destroyed. I tried setting the maxAge and ttl but nothing makes the session survive a browser restart. What am i doing wrong?

The relevant parts of my code are:

var app = express();
var RedisStore = require('connect-redis')(express);

app.use(express.cookieParser('my secret key'));
  app.use(express.session({
  store: new RedisStore({
    host: 'localhost',
    port: 6379,
    ttl: (60000 * 24 * 30),
    cookie: { maxAge: (60000 * 24 * 30) }
  }),
  secret: 'my secret key'
}));
1 Answers
Related