Issue With Cookie Based Login On Load Balanced System

I have a load balanced system with multiple servers. When using “remember me” (Cookie based login), I can see via logs that Yii can only see the cookie if it’s hitting the same server in the backend. As a result, our users’ remember me will work only if they are lucky to hit the right server.

Any idea what i am doing wrong?

TIA

what are you using HAProxy/Nginx?

I’m using AWS ELB

Maybe this will help http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/US_StickySessions.html

Sticky Sessions are bad for multiple reasons, I would store my sessions in database

The sessions are in fact stored in a central db. It looks like the other servers simply can’t read the cookies correctly. I have no issues with shared sessions.