简体   繁体   中英

Cookies not getting Saved on Live website

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.

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 perhttps://devcenter.heroku.com/articles/cookies-and-herokuapp-com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM