CSRF Best Practices
Strict:
Use
SameSite=Strict
for cookies containing sensitive information or those used in critical operations (e.g., authentication cookies).Example:
Lax:
Use
SameSite=Lax
for cookies that should generally be sent in same-site contexts but still allow some cross-site requests (e.g., navigations from external links).Example:
None:
Use
SameSite=None
only when cross-site requests are necessary and ensure theSecure
attribute is present to enforce HTTPS.Example:
Last updated
Was this helpful?