Expires and Cache-Control configuration

Author Message

Pascal France

Tuesday 10 March 2009 8:43:43 am

Hi,

I'm trying to set Cache-Control header to my web pages.

First I've read these topics:

http://ez.no/developer/forum/setup_design/setup_httpheadersettings
http://ez.no/developer/forum/setup_design/httpheadersettings_content_type_application_xhtml_xml

and the comments in [HTTPHeaderSettings] in site.ini.

The form of my URI is: http://mysite.com/xxx/mypage (without .html at the end)

I use a virtualHost as describe in this doc:
http://ez.no/doc/ez_publish/technical_manual/3_8/installation/virtual_host_setup

For now, I can configure Cache-Control for images, javascripts, css, etc ... but not at all for pages with MIME «text/html»

In httpd.conf (Apache 1.3.41 - eZP 3.10.1) I have:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpg "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/x-icon "access plus 30 days"
ExpiresByType text/html "access plus 2 days"
ExpiresDefault "access plus 40 days"
</IfModule>

But the line:
ExpiresByType text/html "access plus 2 days"
has no effect. I always get:

GET /eZ-publish HTTP/1.1
...
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
If-Modified-Since: Tue, 10 Mar 2009 14:48:00 GMT

HTTP/1.x 200 OK
Date: Tue, 10 Mar 2009 14:48:40 GMT
Server: Apache/1.3.41 (Unix)
Expires: Tue, 10 Mar 2009 12:48:40 GMT
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Last-Modified: Tue, 10 Mar 2009 14:48:40 GMT
...

I've tried many other MIME types but without success

So I've set HTTPHeaderSettings in override/site.ini.append.php like this:

[HTTPHeaderSettings]
CustomHeader=enabled
HeaderList[]
HeaderList[]=Cache-Control
HeaderList[]=Pragma
HeaderList[]=Expires

Cache-Control[]
Cache-Control[/]=10000;2;5

But this doesn't product any result.

Thanks for your help.

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Pascal France

Tuesday 10 March 2009 11:12:44 am

Hi,

As I can't set the Cache-Control header for the html document, I've changed the index.php file like this:

 470 // send header information
 471 $headerList = array( 'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
 472                      'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
 473                      'Cache-Control' => 'max-age=1800',
 474                      'Pragma' => ' ',

Now, the answer of the server looks like this:

HTTP/1.x 200 OK
Date: Tue, 10 Mar 2009 17:33:00 GMT
...
Expires: Wed, 22 Jun 2011 01:33:00 GMT
Cache-Control: max-age=1800
Last-Modified: Tue, 10 Mar 2009 17:33:00 GMT
...

...and there is a copy of the html document in the cache of Firefox (I can edit it).

But each time I reload the page, Firefox downlaod the document on the server (statut code 200 OK) and never use the copy in its cache.

Is there really a way to cache the HTML document?

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:12:53
Script start
Timing: Jan 18 2025 16:12:53
Module start 'layout'
Timing: Jan 18 2025 16:12:53
Module start 'content'
Timing: Jan 18 2025 16:12:54
Module end 'content'
Timing: Jan 18 2025 16:12:54
Script end

Main resources:

Total runtime1.0471 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 589.1484152.6406
Module start 'layout' 0.00480.0027 741.789139.4766
Module start 'content' 0.00751.0380 781.2656466.0703
Module end 'content' 1.04550.0016 1,247.335912.1406
Script end 1.0471  1,259.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2985160.0002
Check MTime0.00130.1198160.0001
Mysql Total
Database connection0.00060.055210.0006
Mysqli_queries1.000295.5247520.0192
Looping result0.00050.0475500.0000
Template Total1.019097.320.5095
Template load0.00220.206220.0011
Template processing1.016897.106820.5084
Template load and register function0.00010.010610.0001
states
state_id_array0.00140.136010.0014
state_identifier_array0.00130.124120.0006
Override
Cache load0.00180.1739350.0001
Sytem overhead
Fetch class attribute can translate value0.00060.059310.0006
Fetch class attribute name0.00200.188620.0010
XML
Image XML parsing0.00010.010510.0001
class_abstraction
Instantiating content class attribute0.00000.000820.0000
General
dbfile0.00060.0544100.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs