vendredi 6 février 2015

Get session handling working in AWS Elastic Beanstalk based App

I'm new to AWS and trying to get sessions working in an Elastic Beanstalk based application.


The problem is that my node.js application which is running standalone (without nginx) and implemented with express 4.x, passport & redisStorage which is connected to elastic cache is not able to identify the user.


rea.sessionObject is empty.


I figured out one reason for this problem is the Load Balancer when application is scaling up so I enabled sticky sessions and can see the AWS session cookie inside my applications req.header Object.



{
"error":'NO_LOGGED_IN',
"headers": {
"host": "my.domain",
"accept":
"text/html,application/xhtml+xml",
"accept-encoding": "gzip, deflate, sdch",
"accept-language": "de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4",
"cache-control": "no-cache",
"cookie": "AWSELB=B90F6539046D056220154544DB8A4A4616357D9010.....",
"pragma": "no-cache",
"user-agent": "Mozilla/5.0.....",
"x-firephp-version": "0.0.6",
"x-forwarded-for": "x.x.x",
"x-forwarded-port": "80",
"x-forwarded-proto": "http",
"connection": "keep-alive"
}


The cookie I expect (when running my application in development context) is somethink like this.



"cookie": "connect.sid=s%3A6FpgeuOFbjEktcxhaWHKace75Woc.tGQsBgM9P..."


But what do I need to configure to enable session handling in my application? Had a lot of tries on my load balancer but without luck. But I think there's the problem.


Thanks for any help.





Aucun commentaire:

Enregistrer un commentaire