HTTP cookies
Also called: browser cookies, Set-Cookie, session cookie
A cookie is a small piece of state a browser stores and sends with eligible later requests. A server can set it using Set-Cookie; the browser’s Cookie field carries the stored name and value. Domain, path, lifetime and other rules determine when it is included.
For a hypothetical signed-in session, the browser stores an opaque session identifier, while the server associates that identifier with an account. Secure restricts sending to secure transport, HttpOnly restricts script access, and SameSite limits certain cross-site sending. These attributes address different risks; a cookie itself is neither encryption nor proof that the current holder is authorized.
- Read first
- HTTP headers
- Further reading
- MDN — Using HTTP cookies