overlocked wrote a reply+100 XP
3d ago
That's a good idea, thanks!
But the problem is that Fortify route names don't contain the fortify. prefix.
overlocked started a new conversation+100 XP
3d ago
Currently, I am manually hardcoding paths to check if a URL belongs to active Fortify routes. For example, to avoid redirect loops with url.intended
if (url()->previous() != url('/register') && url()->previous() != url('/forgot-password')) {
session(['url.intended' => url()->previous()]);
}
This approach is brittle. If I enable more Fortify features (like two-factor auth) in the future, I have to remember to manually update this list.I need a dynamic way to either check if a given URL/route belongs to Fortify, or programmatically retrieve a list of all currently enabled Fortify paths.
overlocked liked a comment+100 XP
1w ago
I'm facing the same issue, any solution after 7 months 😅
overlocked liked a comment+100 XP
2mos ago
Just in case someone lands here for Laravel 11, where the TrustProxies.php file does not exist anymore, you can achieve @hermeneus proxy fix into bootstrap/app.php :
return Application::configure(basePath: dirname(__DIR__))
// Your code…
->withMiddleware(function (Middleware $middleware) {
$middleware->trustProxies(headers: Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB
);
$middleware->trustProxies(at: '*');
// Rest of your code… ```