Disabling sessions in frontend prevents logging in to FilamentPHP backend?
I'm using FilamentPHP for my admin backend. I don't need sessions in my (non-admin) frontend. Since I don't need them, I don't want them — GDPR and all that.
I commented out these three lines from the
web
middleware group:
and now the FilamentPHP login window loops. In other words, I enter my credentials and end up back on the login page. There's no error message.
That was unexpected because the admin panel seems to have its own middleware group, and that group already uses the same middleware:
What am I missing?Solution:Jump to solution
OK, I think I have it? I added this to
boot()
, and it seems to be working:
```php
Livewire::setUpdateRoute(function ($handle) {
return Route::post('/livewire/update', $handle)...4 Replies
OK, a little more info.
If I un-comment the
StartSession
line in the web
middleware, I can log in.
If I comment it while I'm on the dashboard page, in development mode, the page almost immediately starts to reload continuously.
I'm not surprised that Filament needs session middleware!
I am surprised that it seems to need it in the web
group, even though it's supposedly using the same middleware itself?I guess you also need to set them for Livewire middlewares
Because Livewire probably relies on web by default
I tried adding this to
AppServiceProvider::boot
, but it didn't work:
Is that the wrong way to do it?Solution
OK, I think I have it? I added this to
boot()
, and it seems to be working: