This might be a good read for you: https://serversforhackers.com/c/so-you-got-yourself-a-loadbalancer
Laravel under a load balancer + centralized redis session storage
Hi all
Sorry if this question has been posted already, I am new here.
So, I have 2 laravel nodes running in separate servers under a load balancer, and a dedicated redis server for session and cache storage.
I configured the session and cache drivers accordingly to "redis" and it connects just fine. I see files being stored inside the redis server.
The issue is when I try to login, the page just gets refreshed without printing the "Invalid credential" errors that are normally stored in session.
Since the load balancer keeps redirecting from one node to another, the session is somehow getting lost. As a single instance it works just fine though.
Is there anyone having the same issue with laravel and load balancing?
If there is a possible fix without configuring the balancer to use sticky sessions, that would be great!
Thanks in advance!
I ended up installing the TrustedProxy package and it works perfectly.
Please or to participate in this conversation.