403 Forbidden in production
Hey !
I'm trying to deploy to production, site is working well but filament admin panel shows 403 forbidden after login
I've implemented the filament contract (returns true for testing purpose)
(Without this implementation I get the 403 forbidden before being able to try login (as intended by Filament))
I can access the filament login page, but once I'm logged in my newly created filament user using:
I get 403 Forbidden and need to clear browser cache to be able to attempt new login
If email/password is wrong I get the normal error and can't login
Everything works fine in local env
Using apache2 proxypass to docker container running my app
Any clues ?
Thank you.
Solution:Jump to solution
Oh i'm actually not using the correct user model... Filament is using Admin model and not User. (might change that)
It works after updating the Admin model, stupid mistake!
Thank you !...
9 Replies
Any Policies, Permission system or similar?
The 403 is coming form Laravel not Apache, right?
Nothing special, the system is quite permissive and no policies set in Laravel providers
403 is from Laravel (default 403 Forbidden page)
I can share debug bar exception trace if it can help :
last 10 calls :
Stack traces always help 🙂
I think this part is relevant. What's line 55 in
Filament\Http\Middleware\Authenticate
(or is it Illuminate/Auth/Middleware/Authenticate
?). In my version that line is a comment or not existing.
I'd focus on Filament\Http\Middleware\Authenticate
. Is 403 thrown by this?
Then your code might not be up to date?Looks like it is :
It shouldn't be there in new versions ?
It should be there. Line 32 is the same as for me.
What does
dd($user instanceof FilamentUser, $user->canAccessPanel($panel))
return?It returns false.
So User model is not updated.
I don't actually understand why, I cleared artisan's and browser's cache
I don't actually understand why, I cleared artisan's and browser's cache
Maybe related to your docker container?
Or OPCache
Solution
Oh i'm actually not using the correct user model... Filament is using Admin model and not User. (might change that)
It works after updating the Admin model, stupid mistake!
Thank you !
Great.