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

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

eZ debug

Timing: Jan 29 2025 13:47:04
Script start
Timing: Jan 29 2025 13:47:04
Module start 'content'
Timing: Jan 29 2025 13:47:04
Module end 'content'
Timing: Jan 29 2025 13:47:04
Script end

Main resources:

Total runtime0.1781 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.3438180.7891
Module start 'content' 0.00540.0058 769.132894.1328
Module end 'content' 0.01120.1669 863.2656533.4844
Script end 0.1780  1,396.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00331.8326200.0002
Check MTime0.00120.6962200.0001
Mysql Total
Database connection0.00050.280210.0005
Mysqli_queries0.131473.78481410.0009
Looping result0.00130.73031390.0000
Template Total0.166693.510.1666
Template load0.00060.350910.0006
Template processing0.165993.181610.1659
Override
Cache load0.00040.246510.0004
Sytem overhead
Fetch class attribute can translate value0.00050.290310.0005
XML
Image XML parsing0.00020.110110.0002
General
dbfile0.00724.0334200.0004
String conversion0.00000.003330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs