Whether session management is enabled for the application
Name of the cookie used to store the session ID
Maximum age of the session data and session ID cookie. Session data is automatically cleaned up after this duration of inactivity. Value can be a time expression (e.g. '2 hours') or number of seconds. Cookie duration is also set to this value unless clearWithBrowser is enabled.
Additional cookie options for the session ID cookie. Excludes maxAge and expires as they're controlled by age and clearWithBrowser.
OptionalrenewWhether to give a new session ID when the cookie names a session the store does not have (expired or destroyed). Defaults to false.
When true, the ID of an ended session is never used again, so a
late request that read the old session cannot write it back. The
session is "fresh". A session without data then gets a new ID on
each request, so do not use session.sessionId as a stable key
for a session without data.
OptionalrefreshWhether to send the session ID cookie on every response, which refreshes its Max-Age. Defaults to true.
When false, the cookie is only sent when the session ID changes (new session, regenerate) or the browser did not send one. A late response then cannot put back in the browser a session ID it has left, e.g. the guest ID after a login that regenerated the session.
The cookie Max-Age is no longer refreshed, so the browser drops the
cookie age after the session started. Pair it with
clearWithBrowser and let the store expire inactive sessions.
Base configuration interface for session management. Used by the session manager and middleware to control session behavior.
Example