Jump to content


Photo

CSS/JS Anti Cache doesn't appear to be correct


In admin/sources/classes/output/publicOutput.php there is this code to generate an "antiCacheHash". This value is appended to the URL of minified JS and CSS so that when the JS/CSS is changed the client knows to make a new request so it doesn't get an outdated version. However, look at the code:


// Set a hash we can use to prevent client caching of CSS/JS
$this->antiCacheHash = md5( IPB_VERSION . $this->settings['board_url'] . md5( $this->settings['sql_tbl_prefix'] . $this->settings['sql_pass'] ) );

The hash value never likely changes except on a full IPB upgrade - it actually does nothing for helping with caching. When using minify on IPB the Expires header is set for 1 year, so until the antiCacheHash is working properly this causes some nasty problems with caching - especially on CDNs.

Status: Fixed
Version: 3.3.4
Fixed In: 3.4.0


4 Comments

Confirming. I've never seen it work properly myself either...always have to do hard refreshes to yield changes..
Updating Fixed In to: 3.4.0
Updating Status to: Fixed

I've added a unix timestamp of the time the skin was last updated into it.

Updating Fixed In to: 3.4.0
Updating Status to: Fixed

I've added a unix timestamp of the time the skin was last updated into it.

 
Could you provide this as a patch (or just show which code needs to be modified to achieve this)?
 
We're currently experiencing problems with this on a CDN and would like to fix this before upgrading to 3.4.
 
Thanks in advance.
    • TSP likes this

 

$this->antiCacheHash = md5( IPB_VERSION . $this->settings['board_url'] . md5( $this->settings['sql_tbl_prefix'] . $this->settings['sql_pass'] ) . $this->skin['set_updated'] );