I have an admin panel built in Laravel 5.8. Admins of the site fill out a complex form to create components that are visible on the front end. Filling out the form can take quite a while. The form is protected behind authentication guard.
The form typically works as expected, but from time to time submitting the form returns a 419 page expired error. The form has a CSRF token and does work in most cases. It is just in some cases when it returns the error.
The site uses the file session driver.
Here are some things I have tried:
- Refreshing the CSRF token at intervals
- Extending the session lifetime
- Clearing the artisan cache
- Having the user clear their browser cache
At this point I am at a loss if the client continues experiencing these issues. It is also extremely difficult to diagnose since there is no evidence in the logs and it seems to happen at random.
Does anyone have experience with CSRF tokens and long forms? Is there anything I can do to prevent this from happening?