Cookies are not being stored in the browser after deployment. I attempted to address the issue by using a full subdomain URL and even tried without specifying a domain, but the problem persists. I am utilizing express-session and passport.js for implement. Backend code deploy on render.
and then, from your frontend, make API requests like: /api/auth/register instead of using the full URL to Render.
On a side note, you can also use Express on Netlify: Express on Netlify | Netlify Docs, which can possibly make this simpler to use instead of managing 2 separate services.
After modifying the ‘_redirects’ file, I attempted to log in and register, but I noticed that the requests are being made from the frontend URL instead of the expected backend URL.
After making further changes to the backend code and the _redirects i.e [ /* /index.html 200 ] file, I am now able to successfully make requests to the backend API. The login process is successful, and I can see the cookie being received in the network tab headers. However, the cookie is not being set in the browser.
“I have set sameSite to none and secure to true , but the cookie is still not being stored and received on the frontend. Here are my frontend login function and express-session settings:”
Sorry to say, but I’d advise you to try debugging the issue on your end, as I’ve been repeteadly saying, this isn’t a Netlify issue, but a coding problem. You should be asking for help on a coding forum.
This time, you’re not sending a response cookie at all: