Reputation: 34203
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?
Upvotes: 5
Views: 7084
Reputation: 171
I recently had this problem and I know not why but it was fixed when I changed (in my AppController beforeFilter() method):
$this->Auth->allow('*');
to
$this->Auth->allow();
Of course then in my subsequent controllers I deny the approriate actions.
Upvotes: 0
Reputation: 3222
Well it appears that there are a number of reasons why this could happen in my case i was trying to access
cakeapplication/users/add
and it came out that i was missing
'add'=>'*',
in the permissions array in usersController.php
Upvotes: 0
Reputation: 10159
This also occurs in CakePHP 1.3 if you add a custom component that extends Component instead of Object.
Upvotes: 7
Reputation: 337
I had the same problem exactly, and when I restarted the mySql service the redirect stopped. So add this to your list of things to check.
Upvotes: 0
Reputation: 31
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.
Upvotes: 3
Reputation: 13172
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
Upvotes: 6