topic
Verified 2026-09-18

Cookie Lifecycle and Scope

Set-Cookie creates or updates a cookie; Cookie sends matching stored cookies back to the server.

Use Max-Age or Expires for lifetime, Domain and Path for scope, and a matching name, path, and domain when deleting a cookie. Cookies are sent with later matching requests.

httpcookiesstate

Reference (http)

Set-Cookie: session=abc123; Max-Age=3600; Path=/
Cookie: session=abc123

Use Max-Age or Expires for lifetime, Domain and Path for scope, and a matching name, path, and domain when deleting a cookie. Cookies are sent with later matching requests.

Common mistakes

  • Using cookies as general storage or trying to delete one with a different Path or Domain.
Permalink: https://merginit.com/reference/http/cookie-lifecycle