I have a nodejs/express + React CRA application, and I'm trying to set a cookie from nodejs. The server is on port 4001, so in my React application's project.json I have "proxy": "http://localhost:4001"
set, but the cookie still won't get set in the browser.
I've tested it in production mode as well, with the React application being served from nodejs directly and it all works fine there.
Here is how I am setting the cookie. I've tried several different combinations of options here and they all have the same result.
res.cookie('jwt', token, {
httpOnly: false,
sameSite: false,
signed: false,
secure: false,
encode: String
});
res.header('Access-Control-Allow-Credentials', 'true');
from Nodejs won't set cookie for React CRA application even with proxy
No comments:
Post a Comment