Closed cbrwizard closed 7 years ago
this module only reset the cookie when we set ctx.session=null
, see https://github.com/koajs/generic-session/blob/master/lib/session.js#L215
can you check your code or debug into egg-generic-session to see what happened?
@dead-horse thanks for a quick answer!
I've solved it. generic-session
wasn't the case. Firstly, the server was restarted with every code change - client included - by nodemon. Secondly, I've used a cookie store and after restarting the server, the session was gone.
This was fixed by switching from cookie store to koa-redis. I will also tell nodemon to not restart the server on client code change.
Hey, I am quite new to cookies and sessions handling in Node, so this might not be even related to this package. But I've noticed that when a request from frontend to my backend has a Request Header
Cache-Control:max-age=0
, a Response HeaderSet-Cookie:koa.sid=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; httponly
is called, which resets the session for me. This happens when I edit the scripts files with Webpack.I think I understand why a Request Header
Cache-Control:max-age=0
is sent (well a file is new after all), but how can I disable the resetting ofkoa.sid
cookie?The funny thing is that
koa.sid.sig
doesn't get reset.My config is: