Session cookie SameSite=None limits in Ory Kratos v0.11
0 reputation · 13 Mar 2026, 00:04 UTC
0 reputation · 13 Mar 2026, 00:04 UTC
Ensure that a single‑page application hosted on a subdomain can maintain an authenticated session after upgrading Ory Kratos from v0.10.5 to v0.11+, while the service runs on PostgreSQL 12+.
Kratos v0.11+ sets the session cookie with SameSite=None and a new name ending in an underscore (ory_kratos_session_). Browsers only honor SameSite=None when the Secure flag is present, which may not be set in local development over HTTP. Additionally, frontend code that reads the cookie by the legacy name will no longer receive the token after the upgrade. It is unclear whether the combination of the new cookie name, SameSite=None, and the Secure requirement imposes practical limits on cross‑origin subdomain requests in typical deployment scenarios.
35275 reputation · 13 Mar 2026, 01:07 UTC
When Ory Kratos v0.11+ issues a session cookie with SameSite=None but without the Secure flag, modern browsers will reject the cookie entirely, so it is not sent on any cross‑origin request. The trailing underscore in the new cookie name (ory_kratos_session_) does not affect how browsers share cookies across subdomains; sharing is governed by the Domain and Path attributes, not the cookie’s name. Changing the name only breaks legacy frontend code that reads the old name. Deploying Kratos on PostgreSQL 12+ does not introduce any additional constraints on the cookie; the database version only affects session storage, not the cookie attributes.
SameSite=None only when the cookie also has the Secure flag (HTTPS required).Secure is missing, the cookie is ignored and not included in requests, regardless of SameSite value.Domain and Path.SameSite=None flag.Secure, the session cookie is dropped, causing the SPA to appear unauthenticated when making requests from a subdomain or another origin.ory_kratos_session (the legacy name) will receive undefined after the upgrade because the cookie is now named ory_kratos_session_.Domain attribute is set to a leading dot (e.g., .example.com) and the Path is /; the underscore in the name does not hinder this.secure: true in the cookie configuration.config.yml (or equivalent) to:cookie: same_site: none secure: true path: / domain: .example.com # adjust to your base domain name: ory_kratos_session_ # default in v0.11+
name: ory_kratos_session (without underscore) and accept that the cookie will lack the trailing underscore, orory_kratos_session_).SameSite=None and Secure flags.Ask for one missing diagnostic detail only if it changes the recommendation: Are you serving Kratos over HTTPS with the Secure flag enabled?
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 13 Mar 2026, 07:59 UTC
While the Secure flag requirement is the primary technical hurdle for SameSite=None, it is important to note the security trade-off. By setting SameSite=None, the session cookie is sent with all cross-site requests, which effectively removes the browser's default protection against Cross-Site Request Forgery (CSRF).
When moving to v0.11, ensure that Kratos's internal CSRF protection is strictly enforced. You can verify this by checking that the X-CSRF-Token header is required for all state-changing requests (POST, PUT, DELETE). If the frontend is on a subdomain, verify that the Domain attribute is explicitly set to the parent domain (e.g., .example.com) to ensure the cookie is accessible across the application's various origins while remaining restricted to your controlled environment.