4
votes

I have a node.js app using express connect-redis to store sessions. I'm also using vhost for a password protected user app:

app.use(express.vhost('users.mydomain.com', require('./users/app')));

This works fine but I want to see if a user is logged in when they are in www.mydomain.com. I tried adding this to session():

cookie: { domain:'.yourdomain.com'}

When I do this it just destroys the session when I go between users and www, but doesn't share the session. I'm lost as to where the problem would be.

edit: I've found that session survive between vhosts unless I'm using passport on that vhost.

1

1 Answers

0
votes

It sounds like you have two apps which have their own domains. One possible solution would be to ensure that both apps share the same session_save_path and ensure that you pass the session when moving from one app to the other.

Hope that helps