Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The SameSite
attribute of the Set-Cookie
HTTP response header allows you to declare if your cookie should be restricted to a first-party or same-site context.
Note: Standards related to the Cookie SameSite
attribute recently changed such that:
- The cookie-sending behavior if
SameSite
is not specified isSameSite=Lax
. Previously the default was that cookies were sent for all requests. - Cookies with
SameSite=None
must now also specify theSecure
attribute (they require a secure context/HTTPS). - Cookies from the same domain are no longer considered to be from the same site if sent using a different scheme (
http:
orhttps:
).
This article documents the new standard. See Browser Compatibility below for information about specific versions where the behavior changed.