Custom Middleware in Filament
I have a custom login in my Filament app but the problem is I'm having trouble in preventing users from going back to my custom login. I implemented a prevent-back-history middleware in my custom login but it's not working.
I also added my custom middleware in
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
PreventBackHistory::class,
])
->authMiddleware([
Authenticate::class,
]);
but whenever I pressed the back button, I always go back to my custom login.
How to add a custom middleware in Filament to prevent users from going back to my custom login page?
I also added my custom middleware in
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
PreventBackHistory::class,
])
->authMiddleware([
Authenticate::class,
]);
but whenever I pressed the back button, I always go back to my custom login.
How to add a custom middleware in Filament to prevent users from going back to my custom login page?
Solution
if you did it laravel way then your route is in
web.php rigth? add guest middleware so only guest users would be able to access it than maybe