Hi,
I just submitted my site to
https://developers.google.com/speed/pagespeed/insights/ and I get:
Consider Fixing: Leverage browser caching: Setting an expiry date
or a maximum age in the HTTP headers for static resources instructs the
browser to load previously downloaded resources from local disk
rather than over the network. Leverage browser caching for the following
cacheable resources:
http://www.xxx.com/w/load.php?debug=false&lang=en&modules=mediawiki…
(5 minutes)
http://www.xxx.com/w/load.php?debug=false&lang=en&modules=site&…
(5 minutes)
http://www.xxx.com/w/load.php?debug=false&lang=en&modules=site&…
(5 minutes)
http://www.xxx.com/w/load.php?debug=false&lang=en&modules=startup&a…
(5 minutes)
This is because by not logged in users, the resource modules are being
requested without "&version=..." since in OutputPage.php it sets
$version = null;
if ( $group === 'user' ) {
// Get the maximum timestamp
$timestamp = 1;
foreach ( $grpModules as $module ) {
$timestamp = max( $timestamp,
$module->getModifiedTime( $context ) );
}
// Add a version parameter so cache will break when
things change
$version = wfTimestamp( TS_ISO_8601_BASIC, $timestamp );
}
with the comment:
we shouldn't be putting timestamps in Squid-cached HTML
and then in the end when the request is handled it runs:
if ( is_null( $context->getVersion() ) || $errors ) {
$maxage = $wgResourceLoaderMaxage['unversioned']['client'];
$smaxage = $wgResourceLoaderMaxage['unversioned']['server'];
// If a version was specified we can use a longer expiry time
since changing
// version numbers causes cache misses
} else {
$maxage = $wgResourceLoaderMaxage['versioned']['client'];
$smaxage = $wgResourceLoaderMaxage['versioned']['server'];
}
which defaults to 5 minutes for unversioned modules and 30 days for
versioned modules.
My problem is that we have a shared server and no Squid caching, so I
think that we do want versioning so that we can get the normal 30 day
maxage.
Can anyone give me advice?
Maybe MediaWiki should contain an optional variable
$wgVersionedModules = true;
so that the line above can read:
if ( $group === 'user' || $wgVersionedModules === true) {
Thanks for any feedback,
Eli