Redirect loop when using Yii ip access rule

Using Yii 1.1.15. I want to restrict the login and logout actions by ip rule. I have this inside the controller:




public function accessRules()

{

	return [

    	[

        	'allow',

        	'actions' => ['index', 'error'],

        	'users' => ['*'],

    	],

    	[

        	'allow',

        	'actions' => ['login'],

        	'users' => ['*'],

        	'ips' => ['xx.yy.zz.qq'],

    	],

    	[

        	'allow',

        	'actions' => ['logout'],

        	'users' => ['@'],

        	'ips' => ['xx.yy.zz.qq'],

    	],

    	[

        	'deny', // deny all users

        	'users' => ['*'],

    	],

	];

}



But when I call the login action in the browser, the browser enters a redirect loop. If I comment out the ips rule, it works. What is wrong with the above code?

Any hints on this one…?

It’s the same situation I’ve fixed in Yii 2.0 recently. Login is allowed only for a certain IP and when it’s not allowed it redirects… to login. Which is not allowed.

Good, so this was a bug. Could you backport the patch to version 1.1?

I’ve create a pull request for the 1.1 branch. Please check it. Thank you.