I don’t believe this has anything to do with cookies. Browsers are not even able to connect to your backend:
Instead of setting CORS headers, you can simply setup Netlify Rewrites: Redirects and rewrites | Netlify Docs
_redirects file: authmaster-frontend/public/_redirects at main · deep0133/authmaster-frontend (github.com) to:
/api/* https://auth-backed-hxu1.onrender.com/:splat 200!
/* /index.html 200
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.
for testing : login page
email : email@example.com
password : 123456
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.
This isn’t a Netlify issue. This is explained by th browser if you go to the cookies tab:
Hover on the small
i and you’ll see the reason.
“I have set
true , but the cookie is still not being stored and received on the frontend. Here are my frontend login function and
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:
The response headers are lacking a set-cookie header. Again, this is a problem with your backend on Render and not on Netlify.