Thursday 11 January 2007 11:23:00 am
In order for Squid to be able to cache requests, eZ Publish must return headers that identify the request as cacheable. In most cases, eZ Publish does this automatically; however, you can finetune this by overriding the default headers.
The headers below show a typical cacheable request returned from eZ Publish. We have disabled the "Pragma" and "Cache Control" headers, which control caching behavior. The "Expires" header defines the period of time during which the item can be cached, before the request needs to be sent through to the webserver again. In this case, the expiry time is set to ten minutes.
header("Pragma: "); header("Cache Control: "); header("Expires: ". gmdate('D, d M Y H:i:s', time() + 600) . "GMT");
Here is an eZ Publish configuration to generate headers specifying cacheable requests for Squid:
settings/siteaccess/PUBLIC_SITE_ACCESS/site.ini.append.php [HTTPHeaderSettings] # Enable/disable custom HTTP header data. CustomHeader=enabled # Cache-Control values are set directly Cache-Control[] Cache-Control[/]= # Expires specifies time offset compared to current time # Default expired 2 hours ago ( no caching ) Expires[] Expires[/]=300 # Pragma values are set directly Pragma[] Pragma[/]=