-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why connect-mongo creates new session for every request? #57
Comments
Check the system clock of both your server and client, make sure they are the same. The client could be immediately expiring its cookies if it has a wrong time. |
i got the same question. here i have a client with 127.0.0.1:3000, and a server with 127.0.0.1:8000, when second request, the session will be a new one without user info. i'm very confused!!! help me. TX |
the client one, the above is server conf |
Check your system time on your server and client. If they are too far apart
|
client and server in the same mac, how the system time wil be not same. how to check system time. TX |
work out. caused by the same ip '127.0.0.1' for both |
the truth is cookie kept by chrome. the key is localhost for cookie when you have 2 web server with the same ip localhost. so i add a key param for express.session : key:'xxxxx', same cookie but different session every request. it works perfect! |
Please explain what you did. I am having the same issue. |
Check out the Express API docs here: http://expressjs.com/api.html#cookieSession The default cookie name is connect.sess. If you don't pass a custom key value to cookieSession(), it will use that name. Do that on two servers and they will overwrite each others' cookies. Very frustrating if you can't figure out what's happening! _example:_ |
connect-mongo stores every ping as a session. This obviously bleeds and makes the session store massive with time. Obviously we can write a service to clean it up but we have chosen to work around it using this hack Once this issue is fixed we can remove it jdesboeufs#57
YaY (dirty) solution found! https://github.com/wesleytodd/express-session-passport-cleanup |
I have two nodejs servers (web-server, socket-server), that are connected to each other by socket.io. On web-service I use express.js and passport.js as authentication middleware.
This is my web-server config:
When I use connect-mongo, it creates a new session for each http-request:
(0 element creates with log in request, other elements are created, when I press F5).
When web-server takes socket connection, connect-mongo creates new session. There are about 50 new documents per minute.
What could be the reason?
In the case of updating the page, helped tip to add app.use(express.favicon()).
With sockets question is still actual.
My socket-server code
And on web-server:
The text was updated successfully, but these errors were encountered: