Session: Max age resetting after response

Created on 16 Feb 2014  路  8Comments  路  Source: expressjs/session

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);
      });
    };
bug

Most helpful comment

Fixing this would require a major version bump, sadly :(
dougwilson added this to the 2.0.0 milestone on 5 Jan 2015

express 4 is out now, what's the reason why the bug is not fixed yet?

All 8 comments

It should only grow (i.e. get reset) when rolling sessions is enabled.

Fixing this would require a major version bump, sadly :(

Fixing this would require a major version bump, sadly :(
dougwilson added this to the 2.0.0 milestone on 5 Jan 2015

express 4 is out now, what's the reason why the bug is not fixed yet?

@timaschew , I'm unsure what the major version of this module has to do with the version of Express.

@jonathanong Just wondering this is not a bug. Once client requests and is being active, to keep the session interactive, maxAge of cookie is been refreshed with each response as cookie expiry disconnects client from session with ongoing interactions.

cc @dougwilson

Hi @HarshithaKP I have never heard of the issue you are describing. Can you provide code and steps to reproduce the issue you are referring to?

@dougwilson Sorry that assumption was a mistake, I will go through the issue again and get back to you.

This issue is not prioritized and has not had meaningful activity for some time. It can be re-opened when a PR is raised, if needed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yolapop picture yolapop  路  3Comments

dumpsayamrat picture dumpsayamrat  路  4Comments

xuya227939 picture xuya227939  路  3Comments

brimsey picture brimsey  路  3Comments

noisytoken picture noisytoken  路  4Comments