Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel redirect with white screen and message "redirecting to..." breaks posts

I have been working with Laravel for quite a while, and encountered a problem with MAMP today. I can't track down its roots since I didn't do a composer update or any other software change that could cause it. Anyways, the problem breaks down the login form on my website on localhost (there is no problem in production, or in the same project on WAMP that my friend is using). The issue makes itself apparent by printing out "redirecting to ..." messages on the screen when a redirect is happening in the application. after submitting my login form I am getting this message and being redirected back to the login page. From what I found on the web the issue might be in the fact that doing redirects somehow kills my post data that should be checked with the login action, thus authentication attempt fails and I am being redirected back to login form. Apparently the error message from auth::attempt is being lost along the way of redirects as well. I have encountered someone facing the same problem and fixing it with nginx, but since I am using mamp with apache2, I couldn't find how to perform the same trick with it. No errors are being logged with this issue. Any ideas on how this can be fixed please?

like image 792
InGWeT Avatar asked May 18 '14 17:05

InGWeT


1 Answers

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

After several hours, I decided to look for spaces at the end of files again, and that was it: Right after the Auth::attempt, I was setting up a Session variable using a Model that had a line break after ?>

This was causing Laravel to show the "Redirecting to..." message, and because it was shown, the session was lost, so the user was not logged in.

This was a Server error only, on my Localhost it always worked fine with spaces.

Hope it helps

like image 119
ecairol Avatar answered Nov 05 '22 16:11

ecairol