New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support manually roll the cookie? #688
Comments
To clarify: you want the behavior of |
@dougwilson yeah, exactly |
@zhaoyao91 Setting |
I mean selectively on a per request basis. For example : if (on some condition) {
req.session.cookie.maxAge = ...
} |
I too would like this feature. I want to set the cookie in the response of any html pages I render, but not for static assets (js, css, etc.). The only way to do this now is to reproduce the call to |
Hi @Piccirello I think this is a different use-case. For example, with static files, it probably isn't just that you don't want to roll the cookie, but do you even need to go through all the work to load the session at all? If you structure to not invoke the session middleware for static assets, it would not only not roll on those responses, but skip all the work of loading the session in those cases as well. |
@dougwilson I was able to implement a better solution based on your info. Thanks for the help! |
I have some pieces of advice here:
|
I'm running into this too. For context: we're using Postgres as a session store and we've implemented We would ideally want behavior like the following:
We can get halfway there by making I know I can use Am I trying to use this library incorrectly? There seems to be an awful lot of friction associated with my goal of not writing to the session store on every request and automatically extending the session after a certain amount of time since the last extension. |
To extend the session in the client side, by now I have to set the
rolling
field totrue
, but that would cause every request carries the set cookie header.Could provide a method such as
req.session.rollCookie()
which allow us roll client side cookie manually?The text was updated successfully, but these errors were encountered: