Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LiorBroshi's avatar

TokenMismatchException on EC2 Spot Instances?

I'm getting quite a lot TokenMismatchException, I assume its since I am using Spot instances that might replace the instance thats actually serving the request (2 Spot instances behind a Load Balancer)

Is there a way to fix this issue? are the tokens saved in the db?

0 likes
3 replies
bobbybouwmann's avatar
Level 88

The tokens are saved by default in the session which is saved on the server itself. You can easily update this the database, so you won't have this issue anymore

You can find more info here: https://laravel.com/docs/6.x/session#driver-prerequisites

Basically you need to run

php artisan session:table
php artisan migrate

And then update your .env to use database as the SESSION_DRIVER.

LiorBroshi's avatar

Right! I thought i've already tweaked this...surprisingly it was set to cookie! Thanks alot!

Please or to participate in this conversation.