DigitalOcean Linux Ubuntu Load Balancer Laravel get 419 Page expired on login

I have 3 running DO Linux Ubuntu 20.04 droplet servers that works well with functionally login session using apache2 with Laravel 8.

When I use load balancer to this 3 droplets, it works and show the webpages well with SSL. The problem occurs when going to login (creating session) and then it will show 419 page expired.

What I have done for the 3 servers:

  1. CSRF on form
  2. chmod 775 on vendor, bootstrap cache, storage
  3. php artisan cache:clear + php artisan config:cache
  4. Using session database instead of default session files (also checked the session is stored well in the database on each droplets)

Most people with the same problem got solved by solution number 4 (database session), but it still doesn’t work on my load balancer. I haven’t found any other solutions so please if maybe anyone know how to solve this problem.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

you have to use a shared db for all the droplets such as digital ocean managed service.
The user session is managed with the database, so you have to “share” the info between all the droplets.

MM


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x