We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 660717e commit e671dc8Copy full SHA for e671dc8
1 file changed
server/src/auth/session.ts
@@ -25,7 +25,10 @@ export const sessionMiddleware = session({
25
cookie: {
26
httpOnly: true,
27
secure: process.env.NODE_ENV === 'production', // HTTPS only in production
28
- sameSite: 'lax',
+ // In production the frontend (Netlify) and backend (Vercel) are on different sites,
29
+ // so we must allow the session cookie to be sent on cross-site XHR/fetch requests.
30
+ // SameSite=Lax works for localhost (same-site) but *blocks* these requests in prod.
31
+ sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
32
maxAge: sessionTTL,
33
},
34
});
0 commit comments