laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.5k stars 11.02k forks source link

Laravel redirect to route not found on Auth Scaffold #26697

Closed IgorDePaula closed 5 years ago

IgorDePaula commented 5 years ago

Description:

I make php artisan make:auth and change the home route, I prefer "dashboard" route, but when I log or register me and try access the login or register page, I receive route home with 404, but have "dashboard"

This occur with laravel 5.7 and 5.6 With anonymous mode browser, this is not occur.

Steps To Reproduce:

Make auth scaffold with "php artisan make:auth" Remove home route, and in auth controllers, change "/home" by "/dashboard", Try register or login with another user with logout, you'll redirect to route home and will receive 404 error

staudenmeir commented 5 years ago

Sounds like a caching issue. Try clearing your browser cache.

IgorDePaula commented 5 years ago

Always this occur, I will have clean the cache? How I explain this to my client?

staudenmeir commented 5 years ago

Did clearing the browser cache fix it?

IgorDePaula commented 5 years ago

Yes, but this is unprofessional, some cookie cause this strange behavior

staudenmeir commented 5 years ago

I'm pretty sure this was a one-time issue in your browser during development.

IgorDePaula commented 5 years ago

No, this occur in my browser and more others 2 browsers, chrome and firefox, on my 2 friends, on linux and windows, no only development, but production too.

Only can a cookie from request.

devcircus commented 5 years ago

As this is something specific to your app, you would probably get a lot more help on slack, laracasts, Laravel.io, or discourse.

IgorDePaula commented 5 years ago

Not specific of my app, on 3 installations this occur.

devcircus commented 5 years ago

if It’s in 3 different fresh Laravel installs then the issue has to be elsewhere in your environment. Permissions, configuration, etc.

IgorDePaula commented 5 years ago

3 different fresh laravel install, on 3 browsers on 3 different pcs, and on 3 different servers. Permissions, configuration cant be, I alter all place "/home" to "/dashboard".

Can someone try test of instead talk?

devcircus commented 5 years ago

Currently testing with 8 different apps on fresh installs on 5.7, PHP 7.2, and MySQL 5.7 with a custom home route.

Reproduce a minimum app that has this issue and throw it up on GitHub. That’s the easiest way to confirm a big in the framework or an issue with your setup.

IgorDePaula commented 5 years ago

Great. change all "/home" route to "/dashboard", for example, on ```php artisan amke:auth" Log in and try access login page or register page. Its redirect to "/home" instead of "/dashboard" route (or another of your preference)

IgorDePaula commented 5 years ago

Tomorow I will put a little app on github and video (now is midnight on my country).

Thanks for your attention.

devcircus commented 5 years ago

Have you changed the “redirectTo” property in your login and register controller to “/dashboard”? Also make sure your dashboard route name is still “home” or replace all references of route(‘home’), in the app with route(‘dashboard’) or whatever the name is.

IgorDePaula commented 5 years ago

I was do this, but this occur when already logged I try access the login page or register page.

Have you changed the “redirectTo” property in your login and register controller to “/dashboard”? Also make sure your dashboard route name is still “home” or replace all references of route(‘home’), in the app with route(‘dashboard’) or whatever the name is.

driesvints commented 5 years ago

Can you first please try one of the following support channels? If you can actually identify this as a bug, feel free to report back.

IgorDePaula commented 5 years ago

Serious? I cant report a bug? No one tried and I'm wrong. Ok.

Azprio commented 5 years ago

In your laravel folder open the file app->Http->Middleware->RedirectIfAuthenticated.php and replace the /home line with suitable url. Thank you.