You are here

function _authcache_builtin_cacheinc_fix_browsers in Authenticated User Page Caching (Authcache) 7.2

Add headers required to make stupid browsers behave.

When modifying this function, do not forget to adapt the respective VCL snipped shipping with the Authcache Varnish Backend.

2 calls to _authcache_builtin_cacheinc_fix_browsers()
authcache_builtin_authcache_backend_cache_save in modules/authcache_builtin/authcache_builtin.module
Implements hook_authcache_backend_cache_save().
authcache_builtin_cacheinc_retrieve_cache_page in modules/authcache_builtin/authcache_builtin.cache.inc
Send cached page to browser, if found.

File

modules/authcache_builtin/authcache_builtin.cache.inc, line 61

Code

function _authcache_builtin_cacheinc_fix_browsers() {

  // Disable browser caching in Safari
  //
  // @see:
  // - https://bugs.webkit.org/show_bug.cgi?id=71509
  // - https://groups.drupal.org/node/191453
  // - https://drupal.org/node/1910178
  if (!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== FALSE && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') === FALSE) {
    drupal_add_http_header('Cache-Control', 'no-cache, must-revalidate, post-check=0, pre-check=0');
  }
}