Setup:
- Multiple laravel replicas behind a load balancer in a private network
- Replicas contact a single master that has the database on the same private network
- Replicas are configured to use the database session driver
- Master has the appropriate session table, created with:
php artisan session:table - Cloudflare fronts the load balancer with https and all the others (incl. the load balancer itself) are http
When I attempt to login, I can see entries being created in the session table (though the IP column being the 10.0.0.0/24 load balancer from the private network), a XXX_session cookie is also created in the browser, but the user is never logged in and gets thrown back to login.
This does not happen if I use the cookie driver instead.
This question and answer sounded promising as it had mentioned editing the session config, but sadly laravel 5.8 detects all items straight from the .env and never falls back to those second default options provided, leaving me with the things I already did as per laravel database session documentation.
Question: What's wrong, is it because laravel writes the private IP instead of the real users IP into the database? if that's the case how do I force it to write the real user IP I get from cloudflare?
Edits:
10/7/2019: Changing the IP to my external IP in the database does not log me in, even if I bypass the load balancer.