Not for all users and not every time but sometimes users cache is disabled for a session, what could be the reason for this?


Members fund testing for the Drupal project. Drupal Association Learn more


znerol’s picture

This might be a bug. The cookies nocache and nocache_temp are set whenever there is a message waiting in the session during hook_exit. During the next page request, authcache makes sure that the page is not served from the cache in order to have an opportunity to display the message to the user.

However I suspect that only nocache_temp should be set in hook_exit and that the nocache serves a different purpose. From what I understand the nocache cookie is supposed to exclude a whole user session from the cache - and not only one request.

Would you please try and comment out line 509 from authcache.module and report back whether it improves the situation. Alternatively you also may just apply the attached patch.

 495 /**
 496  * Implements hook_exit().
 497  *
 498  * Called on drupal_goto() redirect.
 499  * Make sure status messages show up, if applicable.
 500  */
 501 function authcache_exit($destination = NULL) {
 502   global $_authcache_is_cacheable;
 504   if ($destination !== NULL) {
 505     $_authcache_is_cacheable = FALSE;
 507     // Cookie will inform Authcache not to display cached page on next request
 508     if (drupal_set_message()) {
 509       setcookie('nocache', 1, 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
 510       setcookie('nocache_temp', 1, 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
 511     }
 512   }
 514   //TODO:probably move _authcache_shutdown_save_page() code to here if this works
 515   _authcache_shutdown_save_page();
 517 }
nielsvoo’s picture

Dear znerol ,

Unfortunately this solution didn't fix the problem, still session cookies are disabled sometimes. I attached a screen dump.
I think it is good for you to know user authentication is done by LDAP using SSO.

Thank you for your help

nielsvoo’s picture

43.88 KB
znerol’s picture

There are two other places the nocache cookie might get set.

  1. When someone clicks on "Disable caching for this browser session" in the authcache debug widget the cookie is set.
  2. Upon login when the has_js cookie is missing
nielsvoo’s picture

Ok let's say upon login this cookie isn't set indeed, how to force the browser it will?

znerol’s picture

You could try to force the cookie-value by placing the following line of code at the end of your settings.php file:

$_COOKIE['has_js'] = '1';
nielsvoo’s picture

Thank you, this solution does the job!

znerol’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.