views:

1309

answers:

5

I've got a CakePHP site that is stuck in a redirect loop. I've removed every piece of code that does a redirect & I've turned off autoRedirect on the Auth object.

This occurred when I logged out of the site and has persisted even after deleting all cookies and just trying to load the homepage. The index action is in $this->Auth->allow.

I should not, it keeps trying to redirect me to /users/login which then redirect loops. the login action is also in the allowed list

Does anyone have any ideas what could cause this?

A: 

Did you set up the Auth module as instructed in the manual? Sounds like a configuration problem.

A: 

Do you redirect something in routes.php?

ByteNirvana
A: 

Do you have any custom code in your users/login function that would redirect? Is there something in your controllers before that might cause a redirect?

rnavarro
+2  A: 

Your <cake>/app/app_controller should have a beforeFilter() method with all behaviors of Auth component. One of those behaviors is where to send when a user is not logged in.

you will be looking for something like:

// If cake should redirect automatically or you will do it in the User.login()
$this->Auth->autoRedirect = true; 
// And if the autoRedirect is true, where to redirect
$this->Auth->loginRedirect = '/user/login';

G'luck

Fernando Barrocal
A: 

hey sometimes, if you db connection are wrong,,, the application will be trying connect to the mysql, and will be in looping. So, look allways if the database config are right.

good bye.

jean martins