Caching issue - Users need to hit refresh to see most up to date version

Permalink
Got an interesting caching problem on a site...

The site (using v.5.6.3.2) is picking up lots of XML feeds from a 3rd party to populate the site pages. This content is coming in fine.

I'm using C5 in-built caching - I have:

Block Cache = on
Overrides Cache = off
Full page = On
Expire pages from cache = Only when manually removed or the cache is cleared

I am also using John the Fish's super useful 'Cache Filler' (http://www.concrete5.org/marketplace/addons/cache-filler/) to rebuild the cache on the relevant pages.

So, the process is that when a change is made to the data feed, the cache is manually cleared, and the 'Cache Filler' job is run to rebuild the cache. This is all working smoothly...

The problem is that the change doesn't always show for users. Safari and Opera seem to pick up the changes straight away, but most other browser (applications - Firefox / IE / Chrome / Safari on iOs / etc) require a manual refresh in order to show the new cached version of the site pages.

I have tried lots of different combinations of the caching setup - but feel that there must be something more obvious that I'm missing - a server config perhaps?

Can anyone offer any advice as to what I might try to get around this problem and force users to always see the most up to date version of the content without refreshing?

Cheers.

drbiskit
 
enlil replied on at Permalink Reply
enlil
is the site live? I'd like to take a poke if i can and see if i can replicate. I've noticesd some issues like this before, such as when changing a profile pic...
drbiskit replied on at Permalink Best Answer Reply
drbiskit
I've fixed this. It was a fairy simple matter of setting some expire headers using .htaccess

In my specific case, it wasn't really any of the assets (images/css/js/etc) that needed dealing with to fix this issue, but actually just general proxy caching itself - so I added these cache-controlling HTTP headers to my .htaccess file to and it is working nicely:

<IfModule mod_expires.c>
 ExpiresActive on
 ExpiresDefault A0
 Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
 Header set Pragma "no-cache"
</IfModule>


This requires the web server to have both mod_expires and mod_headers enabled, and I did set up a bunch of other far future expire days for other static content/assets.

This is the only workable solution I have found as yet. I am not 100% convinced this is the cleanest solution, so if anyone stumbles on this and has a better solution, I am all ears!

======

Useful (drupal) post on using Apache .htaccess files to stop proxies from caching pages:
https://www.drupal.org/node/32109...

Another useful post with good run down of expire headers at this url:
http://www.xpertdeveloper.com/2011/08/set-expire-headers-using-htac...