Fixed by using sticky session on aws load balancer, and changing session driver from file/database to cookie.
Database session driver recording user_id as null on aws with load balancer. Help
In homestead when using database session driver I don't have problems when logging into application. Everything works as expected. I have since deployed my app to 2 aws ec2 and setup a load balancer pointing to these instances all through forge. I have an rds instance setup for the database.
I can access the apps fine through each of their ips. But if I go to the load balancer at www.mydomain.com I can reach the login page but after login i get exception thrown. Checking the logs shows 'production.ERROR: Illuminate\Session\TokenMismatchException'.
After checking the sessions table in the database it is recording null instead of the logged in user_id like it should.
Does anyone know why this is happening when I am using a load balancer? I would really appreciate some help.
Thank you.
Please or to participate in this conversation.