SameSite Cookie Meaning: Lax vs Strict vs None
TL;DR: SameSite tells the browser when to send a cookie on requests that come from another site. Use this for most login cookies:
Set-Cookie: sid=abc123; Path=/; Secure; HttpOnly; SameSite=Lax
Use Strict for cookies that guard sensitive actions. Use None; Secure only for cookies that must work inside another site (embeds, widgets, some SSO). Don't rely on the default, because browsers don't agree on it. Check your own cookies with our cookie checker.
What does SameSite mean?
When your page at shop.example loads, the browser sends your cookies. That part is easy. The question is what happens when a request to shop.example starts somewhere else: a link on Google, a form on evil.example, an image tag, or an iframe on a partner site.
SameSite answers that. It's an attribute on the Set-Cookie header, and MDN describes it as control over whether a cookie is sent with cross-site requests. The main reason it exists is CSRF (cross-site request forgery). If the browser doesn't send your session cookie on a forged POST from another site, the attack fails.
One detail people miss: "site" is not the same as "origin". A site is the scheme plus the registrable domain. So app.example.com and blog.example.com are the same site. SameSite does not protect you from a sibling subdomain. If someone takes over old.example.com, SameSite won't stop them. (Our subdomain takeover guide covers that risk.)
Lax vs Strict vs None
Here is what each value does, based on the MDN definitions:
| Value | Same-site requests | Cross-site link click (GET) | Cross-site POST form | Cross-site iframe, fetch, img |
|---|---|---|---|---|
Strict |
Sent | Not sent | Not sent | Not sent |
Lax |
Sent | Sent | Not sent | Not sent |
None (needs Secure) |
Sent | Sent | Sent | Sent |
SameSite=Strict
The cookie is only sent when the request comes from your own site. That is the safest option, but it has a side effect. A user who is logged in and clicks a link to your site from an email or from Google arrives logged out on that first page. The browser didn't send the cookie because the click came from another site. After they click around on your site, the cookie is sent again.
That's fine for a bank's "transfer money" cookie. It's annoying for a normal login.
SameSite=Lax
Lax sends the cookie on cross-site requests only when both of these are true (from MDN):
- It's a top-level navigation, meaning the URL in the address bar changes.
- It uses a safe method like GET. POST, PUT and DELETE are excluded.
So a user clicking a link to your site stays logged in. A hidden form on another site that POSTs to /account/delete does not get the cookie. Requests from fetch(), <img>, <script> or iframes on other sites don't get it either.
This is why Lax is a good default for session cookies. It blocks the classic CSRF form post and keeps normal links working.
SameSite=None
The cookie is sent with every request, same-site or cross-site. You need this for cookies that must work when your site is inside someone else's page: an embedded chat widget, a payment iframe, some single sign-on flows.
None only works with Secure. Chrome 80+ and Firefox 131+ reject a SameSite=None cookie that has no Secure flag, according to MDN's browser compatibility data.
SameSite Lax vs None: which one do I need?
Ask one question: does this cookie need to be sent when your site is loaded inside another site, or when another site calls you with fetch()?
- No: use
Lax(orStrict). - Yes: use
None; Secure, and keep that cookie as small in scope as you can. Don't put your main session onNonejust because one widget needs it. Give the widget its own cookie.
Also keep in mind that a None cookie inside another site's page is a third-party cookie. Safari and Firefox block many of those by default. In Chrome, users can block them in settings. Google said in April 2025 that Chrome will keep the existing third-party cookie choice in settings and not add a separate prompt. So None cookies can still fail for some users even when you set them right.
What is the default SameSite value?
This is where it gets messy. MDN's compatibility data, checked today:
- Chrome 80+, Edge 86+, Opera 71+: a cookie with no
SameSiteis treated asLax. - Firefox: Lax-by-default exists only behind the
network.cookie.sameSite.laxByDefaultpreference. It is not on by default. - Safari: no Lax-by-default.
There is one more catch in Chrome. When Lax is applied as a default (not set by you), MDN says a looser version is used: the cookie is still sent on cross-site POST requests if it was set less than two minutes before. Chromium calls this "Lax + POST" and describes it as a temporary measure for SSO in its SameSite FAQ. We couldn't find a public note saying it was removed, so treat it as still there.
The result: a cookie with no SameSite behaves differently across browsers. Thats why scanners flag it, and why you should always set it yourself.
Which SameSite value should I use?
| Cookie | Value |
|---|---|
| Login session | Lax (or Strict if your app has no inbound links that need a logged-in first page) |
| CSRF token cookie | Strict or Lax |
| "Remember me" | Lax |
| Cookie used inside an iframe on other sites | None; Secure |
| Analytics on your own site | Lax |
Some apps use two cookies: a Lax cookie to show the user as logged in, and a Strict cookie that is required for anything that changes data. That gives you working links and strong protection on actions.
SameSite is a second layer for CSRF, not the only one. Keep CSRF tokens on state-changing forms. And add HttpOnly to session cookies so scripts can't read them, plus Secure so they never go over plain HTTP. HSTS helps with that last part (our HSTS guide).
How to set SameSite on your server
Express (Node.js)
res.cookie('sid', token, { httpOnly: true, secure: true, sameSite: 'lax' });
For express-session, put the same options under cookie: { ... }.
PHP (7.3+)
setcookie('sid', $token, [
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
For PHP sessions, set session.cookie_samesite = "Lax" in php.ini.
Django
SESSION_COOKIE_SAMESITE = "Lax"
CSRF_COOKIE_SAMESITE = "Lax"
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
Django already defaults both SameSite settings to "Lax". The Secure ones you have to turn on.
Spring Boot
server.servlet.session.cookie.same-site=lax
server.servlet.session.cookie.secure=true
server.servlet.session.cookie.http-only=true
nginx (in front of an app you can't change)
location / {
proxy_pass http://127.0.0.1:3000;
proxy_cookie_flags ~ secure samesite=lax;
}
proxy_cookie_flags needs nginx 1.19.3 or newer (nginx docs). The ~ matches every cookie name. It's better to fix it in the app, but this works when you can't.
How to check your cookies
From the terminal:
curl -sI https://example.com | grep -i set-cookie
Every line should have SameSite=, and Secure. Session cookies should also have HttpOnly. Some sites only set cookies after login, so check a logged-in page too.
In the browser, open DevTools, go to Application > Cookies (Chrome) or Storage > Cookies (Firefox). There is a SameSite column for each cookie.
Or run your domain through our cookie checker. It reads the cookies your home page sets and flags missing Secure, HttpOnly and SameSite, SameSite=None without Secure, and broken __Host- / __Secure- prefixes. Here's an example: cookie check for github.com. The rest of our free checks are on the tools page.
FAQ
What does SameSite=Lax mean?
The cookie is sent on your own site and on top-level link clicks from other sites. It is not sent on cross-site POST forms, iframes, images or fetch() calls.
SameSite Lax vs Strict: what's the difference?
Strict never sends the cookie on a request that starts on another site, not even a normal link click. Lax allows link clicks (GET navigations). Strict is safer, but users coming from outside links land logged out on the first page.
Why is my SameSite=None cookie rejected?
It's missing Secure. Chrome and Firefox drop SameSite=None cookies without it. Also check that the browser isn't blocking third-party cookies.
What happens if I don't set SameSite?
Chrome and Edge treat it as Lax (with the two-minute POST exception). Firefox and Safari don't apply Lax by default. You get different behavior in each browser, so set it.
Does SameSite replace CSRF tokens?
No. It blocks the most common cross-site attacks, but not requests from your own subdomains, and not in browsers with a different default. Keep CSRF tokens for forms that change data.
Is "Lax" the same as "lax"?
Yes, the value is case-insensitive. SameSite=lax and SameSite=Lax work the same.
Is your site affected? Run the free P-256 check.