Home > other >  Cookies not getting Saved on Live website
Cookies not getting Saved on Live website

Time:05-18

I hosted my client side on Netlify and backend on Heroku. Everything is working fine locally, but as soon as I deployed the changes live it stopped working.

  1. Locally in my client side, I have added proxy in package.json like "proxy": "localhost:5000" (Server was running on 5000 port locally) and it is working and I am able to store cookies in Chrome.

  2. After deploying to Netlify, I just removed the proxy, the user is getting saved successfully in MongoDB which is live but cookies are not getting saved.

I am not sure what I'm doing wrong, since everything is working in local.

CodePudding user response:

You do need a custom domain set for your app.

herokuapp.com is included in the Mozilla Foundation’s Public Suffix List. This means that in browsers that support the functionality (eg. Firefox, Chrome, Opera), applications in the herokuapp.com domain are prevented from setting cookies for *.herokuapp.com.

As per https://devcenter.heroku.com/articles/cookies-and-herokuapp-com

  • Related