Max-Age (cookie attribute)
A cookie attribute giving how many seconds the browser should keep the cookie before deleting it.
In more detail
maxAge: 60 * 60 * 24 * 7 keeps a session for seven days. Without Max-Age or Expires the cookie is deleted when the browser session ends.
Related terms
- cookie — A small named value a server asks a browser to store and send back automatically on later matching requests.
- session — A record the server keeps about a logged-in caller, found on each request through a handle the client presents, usually in a cookie.
Taught in
- Session Management: Secure Cookies & Token Validation — Next.js 15 & Modern App Router Architecture