Admin interface redirect loop

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
simonb
New Member
New Member
Posts: 7
Joined: Fri Mar 11, 2011 3:37 pm

Admin interface redirect loop

Post by simonb »

A site that has been working fine up until now has suddenly started throwing a redirect loop when I try to access the admin interface. The site itself is still OK. I don't know what could have changed since last time I used it. I suspect the host has made some php/apache default config change. Though I can't think what.

It appears that it is not finding cookies. I have cookies enabled and have tried Firefox and Chrome on two different computers all with the same result.

I would appreciate some pointers in identifying and/or debugging what has suddenly gone wrong.

I have attached the debug output and phpinfo output. I had to zip them because I could not upload the HTML files as they were rejected by the forum software.
Attachments
debug.html.zip
Debug mode output of admin login page and phpinfo output.
(11 KiB) Downloaded 163 times
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

I believe the problem I had yesterday seems very similar. I tried so many fixes that I am not entirely sure what fixed it. Part way through the fault finding I upgraded from 1.10.2 to 1.10.3. I had also cleared all cookies & the browser cache.
I believe the final fix was making sure that both my computers time clock and my routers was in sync with my server. I've had problems with my routers NTP settings so a reboot of the router seemed to be the final fix. Definitely seems weird and unrelated to me but I can login again and continue working!
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

Scratch my comments above. I still have the same problem and it's not solved. Let me know if you find the cause/fix.
Thanks Chris
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

OK. Still don't know why but if I go to
"http://www.mydomain.co.uk/admin/logout.php"
and then back to:
"http://www.mydomain.co.uk/admin/login.php"

It works.
I suspect that this is due to me not logging out of the admin area yesterday, and how CMSMS 1.10.3 deals with the redirect after login.

Hopefully someone can find a proper fix, but in the meantime I can work on the site again.

[Edit]this actually worked cos I turned debug on (which disables redirecting on login)
Last edited by Dr.CSS on Thu Jan 26, 2012 7:32 pm, edited 2 times in total.
Reason: Please use double quotes on fake links so they aren't clickable...
simonb
New Member
New Member
Posts: 7
Joined: Fri Mar 11, 2011 3:37 pm

Re: Admin interface redirect loop

Post by simonb »

I just tried it again today and it worked again, as mysteriously as it stopped working.

I wonder if my hosting provider had the system time set wrong on the server yesterday. If it happens again then I will check the system time vs local PC time. I always have my PCs clocks set by NTP.
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

I still get the same problem of a redirect loop every morning when try to login to the admin area.
But the temporary fix is to turn debug on, which then disables redirecting (in the login.php). I can then turn debug off and login normally.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Admin interface redirect loop

Post by Dr.CSS »

Make sure the time zone is set to the servers time zone...
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

Hi Dr. CSS, many thanks for your answer. The server and config setting were different so I hope that is the solution. I'll post here in a few days if it's confirmed.
User avatar
pukka
Forum Members
Forum Members
Posts: 119
Joined: Thu Nov 12, 2009 6:02 pm

Re: Admin interface redirect loop

Post by pukka »

chrisbt,

were you able to solve this issue. I'm getting the same problem on a site i'm working on. It's stuck on a redirect loop on the admin login page. The timezone matches the server timezone and i've set debug to true and it's still stuck in a loop.

I've checked and made sure cookies are enabled and still nothing.

Any help would be appreciated.

P
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

Hi Pukka, No I still have the problem. The only way I get to the login screen is to try to login with debug on and then again with debug off. Then I get the login page.

But it's only the one site I have a problem on. I haven't worked out why yet and found the proper fix. It was a site upgraded from 1.9.3, plus makes extensive use of cookies, plus has FEU and CustomContent installed, plus full CG ecommerce suite of modules. I suspect that somewhere in all of that something is causing this redirect.

I've synchronised timezones everywhere and still no joy.

Once I get to login it's fine then until the next day.

Anything you can share to help pin point the problem would be very appreciated. I need to hand over the the client in the next week or so is becoming urgent.

Cheers
Chris
User avatar
pukka
Forum Members
Forum Members
Posts: 119
Joined: Thu Nov 12, 2009 6:02 pm

Re: Admin interface redirect loop

Post by pukka »

On the IRC it was suggested the problem could be messed up .htaccess settings.


I'm not sure what they meant exactly and they were unable to elaborate. Do you have any idea what they might be talking about.


P
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

Thanks. I've reviewed my .htaccess files and the settings are identical in a site that I can login to and the one that causes the admin login redirects.

I also checked through the the latest sample .htaccess settings in /doc and found one new setting that I didn't have:
php_value session_save_path "tmp/cache"
I added this to my .htaccess but I doubt if this is the issue.

I'll keep working on it and let you know if I find anything else.

Chris
drmikecrowe
Forum Members
Forum Members
Posts: 23
Joined: Sun Sep 20, 2009 1:22 pm

Re: Admin interface redirect loop

Post by drmikecrowe »

With debug turned on, here's what is at the end:

Code: Select all

Debug: (0.129682) - (usage: 19661688) - (peak: 19728816)
(mysql): SELECT ug.user_id FROM cms_user_groups ug
                     WHERE ug.user_id = 0 AND ug.group_id = 1 LIMIT  1
Debug: (0.129848) - (usage: 19662944) - (peak: 19732928)
(mysql): SELECT DISTINCT permission_name FROM cms_user_groups ug INNER JOIN cms_group_perms gp ON gp.group_id = ug.group_id INNER JOIN cms_permissions p ON p.permission_id = gp.permission_id INNER JOIN cms_groups gr ON gr.group_id = ug.group_id WHERE ug.user_id = 0 AND gr.active = 1
Debug: (0.130052) - (usage: 19663384) - (peak: 19737240)
(mysql): SELECT ug.user_id FROM cms_user_groups ug
                     WHERE ug.user_id = 0 AND ug.group_id = 1 LIMIT  1
Debug: (0.130137) - (usage: 19656784) - (peak: 19737240)
No session found.  Now check for cookies
Debug: (0.130175) - (usage: 19657048) - (peak: 19737240)
No cookies found.  Redirect to login.
Is the
ug.user_id = 0
correct?
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 181
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: Admin interface redirect loop

Post by chrisbt »

I believe I finally solved the issue by adding:
sessions.save_path = "tmp/cache" into php.ini
Alternatively add:
php_value session_save_path "tmp/cache" into config.php

I am not certain that this is want fixed the issue but I can now login every time :).
drmikecrowe
Forum Members
Forum Members
Posts: 23
Joined: Sun Sep 20, 2009 1:22 pm

Re: Admin interface redirect loop

Post by drmikecrowe »

Didn't help my case. I believe that your changing of that moved your session data, so it ended up looking like you were a new login. When I deleted my session data in /var/lib/php5/, I could finally log in.

Is it possible it can be related to IP address? I've found that when traveling between home/office, it works fine where it worked before, and fails in the other location.

Also, I *think* that the change needs to be in include.php, if you can't modify your php.ini:

Code: Select all

session_save_path(dirname(__FILE__).'/tmp/cache');
ini_set('session.gc_probability', 1);
although I'm questioning if this is really a "fix". If it helps you clear the session when trying to re-login (at the risk of logging out all your current users unless you find your specific session file).
Post Reply

Return to “CMSMS Core”