1

I’m on Craft v. 2.6.2983 and am encountering the well flagged issue of the control panel logging me out after 60 seconds. I've tried most of the solutions posted here and have had no success in resolving the issue.

We're three months into a Craft deploy this issue has only begun to arise in the last number of weeks.

I’m using redis for session storage and my sessions are remembered when I refresh or open a new tab. Using redis-cli monitor I can see sessions are being stored with the correct TTL.

I've set the following in my config/general.php:

'appId' => 'itmaapp123',
'defaultCookieDomain' => '.itma.ie',
'validationKey' => [REDACTED],
'overridePhpSessionLocation' => 'tcp://redis:6379',
'cacheMethod' => 'redis',
'userSessionDuration' => false

I've also set the relevant variables in config/rediscache.php (including timeout => 300).

Any insights on what might be causing the issue? My stack is Craft 2.6.2983 on nginx with php7.0-fpm and redis for session storage. nginx, php and redis are all running in docker containers behind an nginx reverse proxy. I'm using Cloudflare with SSL for cache and CDN.

Any help much appreciated.

2
  • As a test, can you try disabling Cloudflare? Wondering if they're stripping out PHP/Craft session cookies in the CP.
    – Brad Bell
    Commented Sep 8, 2017 at 16:47
  • Doesn't seem to be the case. I can see cookies are still being set in Chrome inspector. For what it's worth I have Cloudflare set to bypass urls which include the cpTrigger. Starting to wonder if this may be some kind of php/redis issue?
    – piaras
    Commented Sep 12, 2017 at 8:54

2 Answers 2

1

I've had issues before where I was getting logged out and could not fathom why: it turned out (after weeks) that when I was using Inspector Tools' Responsive Design mode, Chrome sends different UA strings... which by default causes Craft to log the user out.

It's a long shot; but see if you're only experiencing the issue when you've got your inspector open and in mobile device simulation / responsive design modes.

The fix for me was to add the following to config/general.php

'requireMatchingUserAgentForSession' => false, // stop Craft logging you out of the CMS while using Chrome's "Device Mode" view for responsive development

1
  • Thanks Matt, I'm afraid issue is still present with that setting. I'm getting the issue on mobile devices and in Firefox so it doesn't seem to be Chrome specific.
    – piaras
    Commented Sep 8, 2017 at 12:20
1

I seemed to have resolved this issue. Though I am not entirely clear about why the following works, I'll describe what worked for me in case someone else is alos having this issue. If anyone can shed more light on why this may have been causing problems please share.

Our website uses localization and as such we have a separate index.php file for each locale.

In my index.php file I am setting variables using ini_set and had been under the impression that it was necessary to set these for each locale.

For instance, I had the following in my main index.php file and the locale index.php file:

ini_set('session.save_handler', 'redis');

Once I removed ini_set calls from the locale index.php files the control panel session issue seems to have been resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.