Community

X-Drupal-Cache is always MISS, content is expired, no-cache header set, even for anonymous users, using APC

Hi guys!

We run a site where 99% of the traffic is from anonymous users. Sometimes the traffic can spike very fast, so caching the barely changing content is essential for the performance. Checking the headers of the returned pages from Drupal, however, we see that all requests have X-Drupal-Cache: MISS set, and all have no-cache set and the expiry date being 1978. This was tested as anonymous user.

We enabled APC and added and configured the drupal apc cache module. On admin/config/development/performance all checkboxes are activated and minimum cache lifetime and expiry are set to 1 hour. (We actually had to set those settings in settings.php, because the page would not save any changes made).

This is what the settings.php file contains:

<?php
$conf
['cache_backends'] = array('sites/all/modules/apc/drupal_apc_cache.inc');
$conf['cache_default_class'] = 'DrupalAPCCache';

$conf['page_cache_without_database'] = true;
$conf['page_cache_invoke_hooks'] = false;

$conf['cache'] = 1;
$conf['cache_lifetime'] = 3600;
$conf['page_cache_maximum_age'] = 3600;
?>

Although the APC statistics show that a lot of data is cached (opcode, system and user caches, so drupal seems to be able to put data into the cache), the headers suggest that all requests are misses. This is an example of the headers we see from anonymous requests:

Cache-Control:no-cache, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Encoding:gzip
Content-Language:nl
Content-Length:8294
Content-Type:text/html; charset=utf-8
Date:Thu, 14 Mar 2013 16:50:41 GMT
ETag:"1363279841"
Expires:Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified:Thu, 14 Mar 2013 16:50:41 +0000
Link:<https://XXXXXX/node/637>; rel="shortlink",<https://XXXXXX/online-therapie>; rel="canonical"
Server:Apache/2
Vary:Accept-Encoding,User-Agent
X-Drupal-Cache:MISS
X-Generator:Drupal 7 (http://drupal.org)
X-Powered-By:PHP/5.3.16

We do not know how to improve this situation, or how to kindly ask drupal to not send the no-cache headers for a clearly anonymous user.
Any help here? Can it be that the clean-urls or any other module is interfering here?

Thanks in advance,
Stefan.

nobody click here