Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

djoe's avatar
Level 1

Session handling - HA wsrep Galera master master replicated access for multiple instances of laravel app

My question is similar to this,

https://laracasts.com/discuss/channels/general-discussion/same-database-maintain-login-across-multiple-apps

I am new here an did not want to interrupt that thread with this, though it is similar.

I am currently running three instances of a laravel 5.0 app on three droplets with nginx. Each application connects individually, to three master-master replicated Galera mysql servers running on three seperate droplets.

The three application instances are also running behind a load balancer, which supports sticky sessions.

I am not the developer of the app, but the server admin for the project, and as I understand it. Laravel supports handling sessions on the database out of the box, by editing the .env file.

My question is, if I would need to have the same application key on each instance to make it work? As I understand it application keys are used for encrypting the sessions.

Currently without sticky sessions, users are randomly forced to login again when the loadbalancer switches servers to balance.

Another alternative would be to seperate mysql traffic and application traffic at the loadbalancer maybe, but I'm not confident in how I would make that work :)

Feedback greatly appreciated

0 likes
1 reply
qazihamayun's avatar

Hi, did you get the answer? if you convert your sessions to Redis or DB, it will work

Please or to participate in this conversation.