I am having two subdomains, api.abc.com
and beta.abc.com
. Both of them are on same server (box), api.abc.com
is running on port 4000
and the beta.abc.com
is running on 5000
. I am also using node-htty-proxy
to reverse proxy the requests. beta.abc.com
is used to serve only static content, while api.abc.com
returns the response in json.
The user authentication is done through facebook oauth on the server (api) side. Once that is done, session is created and the user is redirected to the beta. The problem I am having here is I am not able to persist sessions! I tried giving the domain option in the cookie obj (as i had seen in other questions), even that din't work.
app.use(express.session({ secret: 'omg' , store: new mongoStore({ url: config.db.uri , collection: 'sessions' }) , cookie: { domain: ".abc.com" , maxAge: 1000*60*60*24*30*12 } }))
How do I go about this? Am I doing anything wrong?
I found a very similar question here.