erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
12k stars 2.5k forks source link

Cookies with express session #958

Open khankuan opened 8 years ago

khankuan commented 8 years ago

Hi! I noticed that the express session is only setting cookies after the first response. That means on the first SSR, the session can't be used because the cookie is empty and we're forwarding cookies on ApiClient. Any thoughts? Cheers :)

eliseumds commented 8 years ago

Facing the same issue =S

khankuan commented 8 years ago

I ended up passing special params to the api constructor to set special headers as cookies. In my web route handler, i had to generate the cookie by doing something like https://github.com/expressjs/session/blob/master/index.js#L605 but excluding res and returning the cookie string instead.