Error redirecting a custom page
Good Day,
I am facing the following problem:
I am making a redirect to a filament custom page with the following line:
But the redirect does not go through, and takes me back to the login page.
What can I be doing wrong?
The configuration of the filament custom page is:
Thank you very much.
12 Replies
I think this should work:
Hello Patrick, thank you very much for your reply.
I have tried it too and I get the same url but the redirect is not done, I get only HTTPS 302 and the content is not shown and it redirects me to the login.
Where does the redirect happen? Can you share more code for context?
I understand that the problem in the question is that I am doing the redirect inside a middleware.
The case is the following, I have to check if the user has to change the password. So we have a middleware that checks it after the login of the Filament-Brezzy, but I understand that it should not be a middleware but it should be a function that runs after validating the user, but filament brezzy returns:
And I'm not being able to change to a return redirect(MyCustumPage::getUrl())
middleware does the following:
I think redirecting inside a middleware is fine. Where did you register this middleware, can you share your config?
Another option could be to listen to the
Oops no, nevermind
LoginSuccess
event from Breezy:Yes, of course.
In the filament.php file inside the config, I declare the following:
and in Kernel.php:
and use in web.php
Ok, I'm not sure... Just an idea: Are you sure you need the middleware in both Filament +
web
? Is there any chance the middleware could be triggered for regular app users and would redirect them to a Filament page (which they don't have access to)?Based on what you say, I'm thinking that when I have the middleware Authenticate from filament, the custom page rejects the access because it doesn't have a valid session yet.
The LoginSuccess event would have been a good alternative, because it executes that validation after an OK event occurred.
Yeah, my mistake... I don't think you can redirect from an event handler
I understand. Thank you very much for your time and your answers.
One last question, is it possible to add a custom page to non-logged in users?
Non logged in users would just be a normal Laravel route and view. You can reuse several of the filament components to make it look similar though.
But basically you can’t access a panel or tenant without being logged in.
I think he’s using Filament v2 based on his config file for Filament