<p>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.</p>

<p>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.</p>

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

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

CC BY-SA 3.0
2017-09-08T12:20:16.847Z
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
CC BY-SA 3.0
2017-09-08T11:25:41.257Z
2017-09-08T11:25:41.257Z
Matt Wilcox
<p>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.</p>

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

<p>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.</p>

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

<pre><code>ini_set('session.save_handler', 'redis');
</code></pre>

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

CC BY-SA 3.0
2017-09-15T15:45:45.950Z
2017-09-15T15:45:45.950Z
piaras
<p>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.</p>

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

<p>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. </p>

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

<pre><code>'appId' =&gt; 'itmaapp123',
'defaultCookieDomain' =&gt; '.itma.ie',
'validationKey' =&gt; [REDACTED],
'overridePhpSessionLocation' =&gt; 'tcp://redis:6379',
'cacheMethod' =&gt; 'redis',
'userSessionDuration' =&gt; false
</code></pre>

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

<p>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.</p>

<p>Any help much appreciated.</p>

CC BY-SA 3.0
2017-09-08T16:47:04.147Z
As a test, can you try disabling Cloudflare? Wondering if they're stripping out PHP/Craft session cookies in the CP.
Brad Bell
CC BY-SA 3.0
2017-09-12T08:54:57.020Z
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
<php><session><redis>
Control Panel Session 60 second Timeout
# Control Panel Session 60 second Timeout

(Asked by: username_0 on 2017-09-08)

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.

**Tags:** php, session, redis
> **Comments:**
> **username_1**: As a test, can you try disabling Cloudflare? Wondering if they're stripping out PHP/Craft session cookies in the CP.  
> **username_0**: 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?  

---

## 2 answers

### Answer by username_2 on 2017-09-08. Score: 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`

> **Comments:**
> **username_0**: 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.  

---

### Answer by username_0 on 2017-09-15. Score: 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.


---

