419 Error on fresh Laravel + Filament install

Hey guys,

As many people before me, I am losing my mind over this Session Expired 419 Error on the login page.

This is a fresh install with the following versions:

"require": { "php": "^8.2", "filament/filament": "^3.3", "laravel/framework": "^12.0", "laravel/tinker": "^2.10.1", "livewire/livewire": "^3.6" },

The order of installation:

  1. Laravel
  2. Livewire
  3. Filament
  4. I made a Filament user and tried to log in only to instantly get page expired.
I am really trying to get to the bottom of this because I want to use Filament in production and this cannot be happening with projects where money is involved.

It's alright to do a
$middleware->validateCsrfTokens(except: [ 'livewire/*',
or switch your SESSION_DRIVER to file on a toy project, but not in real-world applications. There has to a be a consisten bug / solution to this error.

Does anyone have a reason / solution for this?

I have currently tried publishing livewire configs, removing the cache multiple times, clearing cookies, clearing the whole Laravel cache, making a new user, running fresh migrations on a new database. Nothing worked.
Solution
Okay, this one was fun.

So, after changing half of my .env file, I found the issue.

APP_NAME="mywebsite.com"

It seems that having an APP_NAME like "mywebsite.com" throws off the session in the login page of Filament because of the dot, even if it's with quotation marks (or without, I tried both). Switching it to APP_NAME="mywebsitecom" (without the dot .) fixed the 419 error on the login page.
Was this page helpful?