Wednesday 24 January 2007 5:05:00 pm
Starting from eZ Publish 3.8, there is a feature for enabling cacheable headers. By default, eZ Publish sends headers in order to prevent proxies and browser caches from storing a cached version of the page. However, in some cases, allowing this can be desirable. You can enable cacheable headers for parts of the site in much the same way as you use the static cache. You can then, for example, place a reverse proxy in front of eZ Publish to handle all caching of pages. Squid is one such application that caches HTTP requests, subsequently serving the same request more quickly. See our article on using Squid to increase eZ Publish performance. Enable and configure cacheable headers in the site.ini.append.php file. Here is an example:
site.ini.append.php: [HTTPHeaderSettings] # Enable/disable custom HTTP header data. CustomHeader=enabled #Set Pragma HTTP header to no-cache for whole site, except /news, and 2 levels below news. Pragma[] Pragma[/]=no-cache;2 Pragma[/news]=;2;0 Response headers from main page Server: Apache/1.3.35 (Unix) PHP/4.4.2 X-Powered-By: eZ publish Expires: Tue, 16 May 2006 07:16:13 GMT Cache-Control: no-cache, must-revalidate Pragma: no-cache Last-Modified: Tue, 16 May 2006 07:16:13 GMT Content-Language: en-GB Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 Response headers from /news folder Server: Apache/1.3.35 (Unix) PHP/4.4.2 X-Powered-By: eZ publish Expires: Tue, 16 May 2006 07:15:47 GMT Cache-Control: no-cache, must-revalidate Last-Modified: Tue, 16 May 2006 07:15:47 GMT Content-Language: en-GB Keep-Alive: timeout=15, max=87 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8
As you can see, the Pragma HTTP header no-cache does not exist in the response headers from the /news folder. Using the configuration file, you can easily control which headers should be used for various parts of the site.