E
E
enhaster2016-09-01 10:56:44
HTTP Cookies
enhaster, 2016-09-01 10:56:44

Expressjs cookie-session (maxAge settings not working)?

Dear time of day,
I can’t understand why the maxAge settings from the configurator do not work:

app.use(cookieSession({
  name: 'sessiondata',
  keys: ['key1', 'key2'],
  cookie: { 
            maxAge: 1 // не устанавливается по умолчанию
          }
    })
);

With this, specifying maxAge manually works:
app.get('/login', function(req, res, next) {
res.cookie('id', 'lol'); //не работает
res.cookie('id2', '2222222', { maxAge: 1222});//работает
res.send(req.cookies.id+req.cookies.id2);
  //res.render('login');
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
enhaster, 2016-09-02
@enhaster

The reason turned out to be simple: This module has no relation to the res.cookie command, so the settings from this module have no effect on res.cookie.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question