My node backend is set on Heroku, React frontend on Netlify. On firefox everything works good but on chrome I can login (post request) and then I can't move on my page cuz cors policy blocks my get requests to the server.
Access to XMLHttpRequest at 'https://xxx.herokuapp.com/api/fetchPurchasedPrizes' from origin 'https://xxx.netlify.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
My backend cors setup
app.use(
cors({
credentials: true,
origin: 'xxx.netlify.app',
}),
);
On localhost both browsers worked good.
CodePudding user response:
Simple solution, I just had to add
cookie: {
sameSite: 'none',
secure: 'true',
},
to my session config.