[GH-ISSUE #1043] Cross subdomain cookie isn’t being set correctly in prod #8565

Closed
opened 2026-04-13 03:41:03 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @erik-kroon on GitHub (Dec 27, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1043

Cross sub domain cookie is not being set correctly in production and I would very much like some help in figuring out why.

solved by using full domain i.e
const MyDomains: Record<string, string> = { development: "localhost", production: "api-app-name.fly.dev", };

instead of fly.dev or .fly.dev

Originally created by @erik-kroon on GitHub (Dec 27, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1043 Cross sub domain cookie is not being set correctly in production and I would very much like some help in figuring out why. solved by using full domain i.e `const MyDomains: Record<string, string> = { development: "localhost", production: "api-app-name.fly.dev", };` instead of fly.dev or .fly.dev
GiteaMirror added the locked label 2026-04-13 03:41:03 -05:00
Author
Owner

@Bekacru commented on GitHub (Dec 28, 2024):

remove defaultCookieAtttribute and only set crossSubdomainCookies

crossSubDomainCookies: {
    enabled: true // true on prod make it false on dev
    domain: ".my-site.com" //put your site domain in this format
}
<!-- gh-comment-id:2564246339 --> @Bekacru commented on GitHub (Dec 28, 2024): remove defaultCookieAtttribute and only set `crossSubdomainCookies` ```ts crossSubDomainCookies: { enabled: true // true on prod make it false on dev domain: ".my-site.com" //put your site domain in this format } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8565