How to Fix Cookies Missing the SameSite Attribute
Your audit flagged one or more cookies sent by your site without a SameSite attribute in their Set-Cookie header. By the end of this guide you will have found every cookie your pages set, added an explicit SameSite value (usually Lax) at the source or at the web server, and confirmed the headers in curl and browser DevTools.

Why it matters
SameSite tells the browser whether to attach a cookie to requests that start on another website. Without it, behaviour depends on the browser: Chromium-based browsers treat a missing attribute as Lax, but other browsers and older clients may send the cookie on cross-site requests, which is what cross-site request forgery (CSRF) attacks rely on. Setting it explicitly gives consistent protection for logged-in sessions, carts and admin areas, removes console warnings, and shows auditors and security scanners that cookies are deliberately configured.
It has no direct ranking effect, but it is a cheap hardening step that reduces risk to users.
What you need
Step-by-step fix
List every cookie your pages set
The check looks at the Set-Cookie headers returned when your page loads, so start there. Run curl against your homepage and key templates (product, login, cart) and note every cookie that has no SameSite= part. In Chrome you can also open DevTools > Application > Cookies > your domain and look for an empty SameSite column, or DevTools > Network, click the document request and read the response headers.
curl -sI https://example.com/ | grep -i '^set-cookie' curl -sI https://example.com/cart | grep -i '^set-cookie'
Pick the right SameSite value per cookie
Choose deliberately rather than applying one value everywhere:
- Lax: the sensible default for sessions, carts and preferences. Sent on normal top-level link clicks from other sites, blocked on cross-site POSTs and iframes.
- Strict: for admin or high-privilege cookies. Never sent cross-site, so users arriving from an external link appear logged out on the first request.
- None: only for cookies that genuinely must work in cross-site contexts (embedded widgets, some SSO and payment flows). Browsers reject
SameSite=NoneunlessSecureis also set.
Set SameSite where your app creates cookies
Fixing at the source is cleanest. In Express pass sameSite in the options object; in PHP 7.3+ use the options array form of setcookie(). Include Secure and HttpOnly at the same time for session cookies that JavaScript does not need to read.
// Express
res.cookie('sessionid', value, { secure: true, httpOnly: true, sameSite: 'lax', path: '/' });
// express-session
app.use(session({ secret: process.env.SESSION_SECRET, cookie: { secure: true, httpOnly: true, sameSite: 'lax' } }));
<?php
// PHP 7.3+
setcookie('sessionid', $value, [
'expires' => time() + 86400,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);Configure PHP session cookies
The PHPSESSID cookie is created by PHP's session handler, not your code, so it needs its own setting. Set session.cookie_samesite in php.ini (or your host's PHP settings panel), or early in the request before session_start() runs. On WordPress, wp-config.php is a convenient place because it loads before plugins start sessions.
; php.ini
session.cookie_secure = 1
session.cookie_httponly = 1
session.cookie_samesite = "Lax"
<?php
// wp-config.php (above the 'That's all, stop editing!' line)
@ini_set('session.cookie_secure', 1);
@ini_set('session.cookie_httponly', 1);
@ini_set('session.cookie_samesite', 'Lax');Add a server-level fallback for cookies you can't edit
If a plugin, legacy app or upstream service sets cookies you cannot change, add the attribute at the web server. Nginx 1.19.3+ supports proxy_cookie_flags for proxied responses. Apache's mod_headers can append SameSite only to cookies that don't already have it, so you don't override deliberate values.
# Nginx (in the location that proxies to your app) proxy_cookie_flags ~ secure httponly samesite=lax; # Apache (.htaccess or vhost, requires mod_headers) <IfModule mod_headers.c> Header always edit Set-Cookie "^((?!.*;\s*[Ss]ame[Ss]ite=).*)$" "$1; SameSite=Lax" </IfModule>
Test cross-site flows, then re-check the headers
Clear cookies and log in, add to cart, complete a test checkout and use any SSO or embedded widget to confirm nothing broke. Then repeat the curl commands from step 1: every Set-Cookie line should now contain SameSite=. Re-run the audit to clear the warning.
curl -sI https://example.com/ | grep -i '^set-cookie' | grep -vi 'samesite=' # No output means every cookie on this response has SameSite set
Platform-specific notes
WordPress
Core login cookies (wordpress_logged_in_*, wordpress_sec_*) are set with setcookie() without SameSite and are only issued on login, while flagged cookies on public pages usually come from plugins or PHP sessions. Use the wp-config.php session settings, ask the plugin author to add SameSite, or append it with the Apache/Nginx rule. Managed hosts like WP Engine or Kinsta may need a support ticket for server-level header edits.
Shopify
You cannot change Set-Cookie headers on Shopify's servers; Shopify's own cookies (_shopify_y, cart, etc.) already ship with SameSite. Cookies missing it typically come from third-party apps or scripts, so identify the app from the cookie name and contact its developer or remove the app. Cookies written with document.cookie in theme.liquid can be fixed by appending '; SameSite=Lax; Secure' to the string.
Next.js
In the App Router use cookies().set({ name: 'sessionid', value, httpOnly: true, secure: true, sameSite: 'lax', path: '/' }) in Route Handlers or Server Actions; in middleware use response.cookies.set(name, value, { sameSite: 'lax' }). For auth libraries such as Auth.js, configure the cookies option, which defaults to sameSite 'lax'.
Cloudflare
Cloudflare's own __cf_bm and cf_clearance cookies already include SameSite=None; Secure, so they pass. To patch origin cookies at the edge, use a Cloudflare Worker that rewrites Set-Cookie headers on the response, since that is the reliable way to edit them in flight.
Wix / Squarespace / Webflow
Hosted builders set platform cookies themselves and don't expose Set-Cookie configuration. Flags usually come from embedded third-party code; update or remove that embed, or fix any custom document.cookie code you added.
Check that it worked
✅ How to verify
- Run curl -sI https://example.com/ | grep -i set-cookie and confirm every line includes SameSite=Lax, Strict or None
- In Chrome DevTools > Application > Cookies, check that the SameSite column is filled for every cookie on your domain
- Check the DevTools Issues tab for no remaining SameSite cookie warnings
- Re-run the site audit and confirm the 'Cookies set SameSite' check passes
⚠️ Common mistakes
- Setting SameSite=None without Secure, which makes browsers reject the cookie entirely
- Applying Strict to session cookies site-wide, which logs users out when they arrive from search results, emails or payment redirects
- Fixing only your app's cookies and forgetting PHPSESSID or cookies set by plugins, CDNs and third-party scripts
- Relying on Chrome's Lax-by-default behaviour instead of setting the attribute explicitly for all browsers
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
Should I use SameSite Lax or Strict?
Use Lax for most cookies, including login sessions and carts; it blocks cross-site POSTs and iframes while keeping users logged in when they click a link to your site. Use Strict for admin or banking-style cookies where the minor inconvenience of being logged out on cross-site arrival is acceptable.
What happens if a cookie has no SameSite attribute?
Chrome, Edge and other Chromium browsers treat it as Lax, but behaviour has differed across Firefox, Safari and older browsers. Setting the value explicitly ensures consistent CSRF protection and removes audit and console warnings.
Will SameSite=Lax break my payment gateway or login with Google?
Usually not, because those flows return the user via top-level navigation, which Lax allows. Problems appear when a provider POSTs back to your site or runs inside an iframe; in that case set only the affected cookie to SameSite=None; Secure.
Can I fix SameSite for third-party cookies on my site?
Only cookies set on your own domain's responses are under your control. Cookies set by another domain's scripts or iframes must be fixed by that provider, though most major vendors already set SameSite=None; Secure.
How to Fix Missing Clickjacking Protection (frame-ancestors)
How to Fix Cookies Missing the HttpOnly Flag on Your Site
How to Fix a Missing Permissions-Policy Header on Your Site
How to Fix Cookies Missing the Secure Flag on HTTPS
How to Fix Vulnerable JavaScript Libraries on Your Site
How to Fix a Low TLS Security Grade (Protocols, HSTS, Certs)