Original Post: https://letitcode.dev/t/cookies-not-working-after-deploying-render-netlify-samesite-vs-secure-explained/67
Struggling with auth cookies that work on localhost but break after deploying to Render and Netlify? The root cause is likely a SameSite cookie issue.
Because *.netlify.app and *.onrender.com are different registrable domains (eTLD+1), they are considered cross-site. In this environment, default SameSite=Lax cookies are not sent on fetch or XHR requests. While browsers treat localhost/loopback addresses as secure contexts even over HTTP—hiding these issues during development—production requires explicit configuration.
To fix this, you must:
• Set SameSite to 'none' in your backend cookie options.
• Set Secure to true (this is mandatory when SameSite is 'none').
• Ensure both your frontend and backend are running on HTTPS.
• Enable credentials: 'include' in your frontend fetch/axios requests.
Learn how to update your Express/NestJS config to handle cross-site cookies and solve the "works locally, breaks in prod" problem for good!
Download
0 formats
No download links available.
Cookies Not Working After Deployment? Fix SameSite & Secure (Render + Netlify) | NatokHD