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

Ryahn's avatar
Level 2

Load Balancer Breaks SSO

I have 4 VPS setup as web servers and a load balancer through digital ocean. If I keep 1 server in the load balancer, SSO works fine. When I add a second or more servers, its stops working.

What I mean by it stops, is that it starts to give a 500 error but for whatever reason will randomly register or not register a new user.

The load balancer has sticky sessions enabled and all the web servers are identical. There is a separate VPS that is running the database that they all connect to and I dont have any issues with it working with the database.

I cant figure out why it wont work on the load balancer at all. I have a similar setup in my house using VMs and nginx doing the load balancing without issue.

0 likes
3 replies
D9705996's avatar

Do you have any details of the 500 error from your logs?

Ryahn's avatar
Level 2

After I did some more digging around. I found that my session and cookies where the cause.

config/session.php had 'domain' => env('SESSION_DOMAIN', null), and my .env doesnt have this defined. I added and set the domain as needed. Cleared my cookies, cache, ran php artisan cache:clear and composer dump-autoload

The login now works without issue.

Please or to participate in this conversation.