Page MenuHomePhabricator

Figure out why Firefox disobeys caching headers from RL, test cacheability of RL responses in other browsers
Closed, DeclinedPublic

Description

Per summary


Version: 1.17.x
Severity: enhancement

Details

Reference
bz25744

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:21 PM
bzimport set Reference to bz25744.

I found I had to add this to LocalSettings.php because the main skin CSS and the startup script didn't have a version on:

Force ResourceLoader to serve unversioned resources for 30 days as well (normally 5 min)

$wgResourceLoaderMaxage['unversioned'] = array('server' => 30 * 24 * 60 * 60, 'client' => 30 * 24 * 60 * 60);

Without it Firefox 4 was attempting to retrieve them every time. They're still not sent with a content-length, which seems wrong, but at least it doesn't do that.

(In reply to comment #2)

I found I had to add this to LocalSettings.php because the main skin CSS and
the startup script didn't have a version on:

Force ResourceLoader to serve unversioned resources for 30 days as well

(normally 5 min)
$wgResourceLoaderMaxage['unversioned'] = array('server' => 30 * 24 * 60 * 60,
'client' => 30 * 24 * 60 * 60);

Without it Firefox 4 was attempting to retrieve them every time. They're still
not sent with a content-length, which seems wrong, but at least it doesn't do
that.

That's not a proper fix, as it will make invalidations (updates to JS/CSS) take unreasonably long.

(In reply to comment #1)

Trevor? Roan? anything to do here?

I logged this as a TODO a long time ago to investigate caching behavior, but I don't think I'm gonna get to it soon.

That's not a proper fix, as it will make invalidations (updates to JS/CSS)
take unreasonably long.

Well, if they can change, why are they being sent without a version or date in the first place? :-)

(In reply to comment #4)

That's not a proper fix, as it will make invalidations (updates to JS/CSS)
take unreasonably long.

Well, if they can change, why are they being sent without a version or date in
the first place? :-)

Because the version parameter would be embedded in HTML and be cached in Squid otherwise.

The version parameter has two uses. First, its presence indicates that the request can be cached for 30 days (5 minutes if absent). Second, changing its value will cause a cache miss (since the URL is different). The idea here is that the startup module lists the last-changed timestamps for each module, which we then use to build the versioned URLs. This way, the startup module is refreshed every 5 minutes and the other modules are only refreshed when they've changed (or after 30 days).

This seems fine now, I'm no longer seeing any caching weirdness in Firefox.