HTML Cache header problems. Need a force refresh to get the actual webpage content

Author Message

Romeo Antony

Wednesday 23 March 2011 4:31:18 am

Hi,

My site is having some serious issues with cache headers.

site is configured with squid as reverse proxy

Even after I logged out from the site, it shows me as logged in. when I do a force refresh, squid clears the requested url from is cahes and fetch the webpage from apache webserver. So that I need to refresh each page that is already in the squid cache to clear it from squid cache to get originalwebpage.

This is the headers that ez send from siteaccess

[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[/]=

And in apache I have configured cache headers as

# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=172800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=3600, private, proxy-revalidate"
</FilesMatch>

In virtualhost configuration cache headers as

<IfModule mod_expires.c>
<LocationMatch "^/var/[^/]+/storage/images/.*">
# eZ Publish appends the version number to image URL (ezimage
# datatype) so when an image is updated, its URL changes to
ExpiresActive on
ExpiresDefault "now plus 10 years"
</LocationMatch>

<LocationMatch "^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?|flash)/.*">
# A good optimization if you don't change your design often
ExpiresActive on
ExpiresDefault "now plus 5 days"
</LocationMatch>

<LocationMatch "^/extension/[^/]+/design/[^/]+/lib/.*">
# Libraries get a new url (version number) on updates
ExpiresActive on
ExpiresDefault "now plus 90 days"
</LocationMatch>

<LocationMatch "^/design/[^/]+/(stylesheets|images|javascripts?|lib|flash)/.*">
# Same as above for bundled eZ Publish designs
ExpiresActive on
ExpiresDefault "now plus 7 days"
</LocationMatch>

<LocationMatch "^/share/icons/.*">
# Icons as used by admin interface, barly change
ExpiresActive on
ExpiresDefault "now plus 7 days"
</LocationMatch>

# When ezjscore.ini/[Packer]/AppendLastModifiedTime=enabled
# so that file names change when source files are modified
#<LocationMatch "^/var/[^/]+/cache/public/.*">
# Force ezjscore packer js/css files to be cached 30 days
# at client side
ExpiresActive on
ExpiresDefault "now plus 30 days"
#</LocationMatch>
</IfModule>

I would like to cache all html pages in squid .But squid should check from apache webserver that any changes is made upon the respective html files. If there any change in html, it should show the latest changes. I think following cache header is misconfigured.

<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=3600, private, proxy-revalidate"
</FilesMatch>

ANy ideas will be a great help.

Regards

Romeo

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