nduagoziem's avatar

Filament Login fails in production (403 Forbidden) but works in local environment

I deployed my laravel API on a VM instance (Oracle Cloud) running Ubuntu 24.04, while my Nuxt Frontend is deployed on Vercel. I am using Laravel Sanctum for SPA authentication. Everything works fine, but when I try to log in as the admin on Filament, I get a 403 Forbidden. The same thing happens on the frontend: when a user tries to log in or make any POST request, it doesn't go through. Below is the error log from my log file.

[2025-12-04 15:37:08] local.ERROR: Route [login] not defined. {"exception":"[object] (Symfony\Component\Routing\Exception\RouteNotFoundException(code: 0): Route [login] not defined. at /var/www/my-laravel-app> [stacktrace] #0 /var/www/my-laravel-app/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(883): Illuminate\Routing\UrlGenerator->route() #1 /var/www/my-laravel-app/vendor/laravel/framework/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php(278): route() #2 [internal function]: Illuminate\Foundation\Configuration\ApplicationBuilder->{closure:{closure:Illuminate\Foundation\Configuration\ApplicationBuilder::withMiddleware():276}:278}() - I can't paste everything here because it is a lot.

If I switch the APP_ENV variable to local, everything works on both sides. Still, whenever I switch to production, the frontend shows a 419 error when I'm trying to make a POST request, e.g a login, and the backend shows 403 when trying to log in via Filament.

I'm suspecting a CORS or CSRF issue, but I'm unsure how to pinpoint it.

0 likes
5 replies
nduagoziem's avatar

Thanks.

This solved the Filament 403 error - I didn't implement FilamentUser interface in my User class. But I'm still getting the 419 error from the frontend when a POST request is made.

jlrdw's avatar

But I'm still getting the 419 error from the frontend when a POST request is made.

Is this a web route for admins?

nduagoziem's avatar

The two issues have been resolved. @earmsby, thanks a lot for your help in solving the Filament 403 error. The 419 error was from my laravel code. I added a middleware where I shouldn't have added one.

Please or to participate in this conversation.