Laravel redirect with a white screen and the message "redirect to ..." interrupts the message

I worked with Laravel for a long time and today I ran into the MAMP problem. I cannot trace its roots since I did not make composer updates or other software changes that could cause it. In any case, the problem breaks the login form on my site on localhost (there are no problems in production or in the same WAMP project that my friend uses). The problem arises because the message "redirect to ..." appears on the screen when redirecting to the application. after sending my login form I get this message and redirected back to the login page. From what I found on the Internet, the problem may be that doing the redirect somehow kills my data, which must be verified using the login action, so the authentication attempt failed, and I was redirected back to the login form. Apparently, the error message from auth :: try also disappears along the redirect path. I ran into someone having the same problem and fixed it with nginx, but since I use mamp with apache2, I could not find how to perform the same trick with it. No errors are logged with this problem. Any ideas on how this can be fixed, please?

+7
redirect apache apache2 mamp laravel
source share
3 answers

I had exactly the same error, and I tried all types of solutions: nginx, filtering, spaces at the end of files.

After a few hours, I decided to look for spaces at the end of the files again, and it was like this: right after Auth :: try, I set up a session variable using a model that had a line break after? >

This led to Laravel displaying a β€œRedirect to ...” message and, as shown, the session was lost, so the user was not logged in.

It was a server error, on my Localhost it always worked fine with spaces.

Hope this helps

+4
source share

You can redirect without losing input with withInput() :

 Redirect::to('form')->withInput(Input::except('password')); 
0
source share

I had exactly the same error, and I tried all the solutions mentioned in the other answers, but with no result. After a while, I made a discovery, and the problem arose because I had a lot of logic in my App::before filter.

I tried to move the logic, but that didn’t work either, so the only options I have left are to execute the logic after loading the page or just delete it and find another way.

0
source share

All Articles