I've my application(react app) running in localhost:3000 & my express server running on https://some-domain.com, I'm unable to set cookie from my express to localhost. I'm using express-session & redis-store.
Asked
Active
Viewed 103 times
0
-
Maybe this could help: [https://stackoverflow.com/a/48231372/8962088](https://stackoverflow.com/a/48231372/8962088) It seems to be a CORS issue. – Grifo Aug 10 '23 at 20:05
1 Answers
0
To set "credentials" in server we need this line:
res.header('Access-Control-Allow-Credentials', true)
add this in cors middleware
This would let you handle credentials included in headers.
You also have to tell to axios to set credentials in headers with:
withCredentials: true

Akshay Darji
- 111
- 4
-
Yup, but still its not working.., If I run both app in localhost it works but, on the different domain not working..! – nishanth_duraisamy Apr 27 '23 at 14:46