Cookie SameSite Debugging Guide

Secure, HttpOnly, SameSite, CORS credentials, browser DevTools and session failures. Last updated August 31, 2026.

MDN documents Set-Cookie attributes including Secure, HttpOnly, Path, Domain and SameSite. SameSite=None requires Secure, and HttpOnly prevents JavaScript access to the cookie while still allowing the browser to send it with HTTP requests. See MDN Set-Cookie and MDN Using HTTP cookies.

Common session failure pattern

SymptomLikely causeNext check
Login succeeds but next API call is anonymousCookie not stored or not sentCheck Set-Cookie, browser Application tab and request Cookie header.
Works on localhost, fails on domainHTTPS, domain, path or SameSite mismatchCompare localhost exception with production HTTPS behavior.
Cross-site frontend cannot stay logged inMissing SameSite=None; Secure or missing CORS credentialsCheck frontend credentials mode and CORS response headers.
JavaScript cannot read session cookieHttpOnly is setThis is usually correct for session cookies.

Inspect cookie headers

curl -i https://app.example.com/login
curl -I https://app.example.com/
curl -i https://api.example.com/me \
  -H "Origin: https://app.example.com" \
  -H "Cookie: session=REDACTED"

Attribute checklist

Cross-site API checklist

frontend fetch credentials:
api Access-Control-Allow-Credentials:
api Access-Control-Allow-Origin:
cookie SameSite:
cookie Secure:
cookie Domain:
cookie Path:
request Cookie header present:
browser blocked reason:

Safer cookie starter

Set-Cookie: __Host-session=REDACTED; Path=/; Secure; HttpOnly; SameSite=Lax

The __Host- prefix is useful when the cookie should be bound to the exact host, have Path=/, use Secure and avoid a broad Domain attribute.

Cookie debugging requires both sides of the story: the response that sets the cookie and the later request that should send it. Looking at only one side creates false answers.

Related: CORS Debugging Guide, OAuth JWT Debugging, HTTP Security Headers Checklist, curl API Debugging Cheatsheet.