Skip to content

Max age resetting after response #2

Open
@jonathanong

Description

@jonathanong

Is there a reason the max age is reset with each response?
I need to be able to see if half of TTL has elapsed. The cookies expiration is being increased but the session still expires at the original max age.

   // proxy end() to commit the session
    var end = res.end;
    res.end = function(data, encoding){
      res.end = end;
      if (!req.session) return res.end(data, encoding);
      debug('saving');
      req.session.resetMaxAge();
      req.session.save(function(err){
        if (err) console.error(err.stack);
        debug('saved');
        res.end(data, encoding);
      });
    };

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions