Are you setting the same key in APP_KEY for each app server?
Without it, you will lose login session data under the round robin load balancer environment.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I'm having an issue with session data not persisting when using a load balancer and Redis, all configured via Forge.
The setup is as follows:
At the moment I have the load balancer set up as "Round robin". However, on every page refresh that it swaps to the other server, the session ID is changing and so it's screwing my application. I need the session to persist over the server swaps.
I'm using a remote Redis application and as far as I'm aware I have all the .env variables set correctly on both application servers.
If I run Redis-cli keys* on the Redis server, I can see lots of _cache files being generated on each page refresh.
I have tried adding the load balancer IP to the proxy section of TrustedProxies but this did nothing.
This is the environment settings I have, duplicated on both application servers:
CACHE_DRIVER=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_CONNECTION=session
SESSION_DOMAIN=".domain.com"
REDIS_CLIENT=predis
REDIS_HOST=111.111.111.111
REDIS_PASSWORD=""
REDIS_PORT=6379
Anything else I can look at?
Please or to participate in this conversation.