question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Max age resetting after response

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
timaschewcommented, Aug 30, 2016

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?

0reactions
davidmashecommented, May 11, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maxage of my cookie is reset to -1 - Stack Overflow
This is expected behaviour. Take into account that max-age applies to a client-side, but clients will only send to server the pair name ......
Read more >
Access-Control-Max-Age - HTTP - MDN Web Docs
The Access-Control-Max-Age response header indicates how long the results of a preflight request (that is the information contained in the ...
Read more >
How can I reset the max-age cache control of my page being ...
I have tried to add the following code on the page, restarted the server. No redirection happened, but then the page was totally...
Read more >
Cache-Control - HTTP
Specifying no-cache or max-age=0 indicates that clients can cache a resource and must revalidate each time before using it. This means HTTP request...
Read more >
Keeping things fresh with stale-while-revalidate - web.dev
A Cache-Control response header that contains stale-while-revalidate should also contain max-age , and the number of seconds specified via max- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found