Page MenuHomePhabricator

SquidPurgeClient.php provides no hooks for extensions to purge individual files from non-Squid, non-Varnish content delivery networks
Open, NormalPublic


Author: carlb613

SquidPurgeClient.php seems hard-coded so content delivery network (CDN) nodes are presumed to be Squid, compatible with HTTP PURGE sent from a trusted IP address.

This works if the cache acts like a Squid (Varnish is configurable to do this) but is problematic when dealing with commercial content delivery networks.

Services like CloudFlare (or Amazon AWS) expect the origin server to invoke their specific proprietary API to signal that a page or file has been superseded with updated content.

HTTP PURGE likely doesn't even reach them as the long list of IPv4 / IPv6 ranges is normally handled with [[mw:extension:TrustedXFF]] or a proprietary module (like mod_cloudflare for Apache). Even if it were possible to list the entire CDN in $wgSquidServers, those servers would ignore a Squid-style PURGE message.

The end result is that plenty of outdated content is served as the CDN has no way to know a new version exists until the original version expires from cache.

There needs to be a way to replace the stock SquidPurgeClient with an extension which provides a function to purge CDN files, but I see no hooks in the code to allow this. There are [[mw:Manual:CloudFlare#HTTP_purge]] extensions for WordPress, Drupal and the like but nothing for MediaWiki as the hook to add such an extension does not exist.

Version: 1.23.0
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:07 AM
bzimport added a project: MediaWiki-General.
bzimport set Reference to bz62356.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Mar 7 2014, 2:10 AM

Hmm, that's odd we have no hook there (Note that we do have a hook for purging thumbnails - LocalFilePurgeThumbnails, but nothing for general article purging)

Carlb added a subscriber: Carlb.Aug 9 2015, 10:53 PM

Would it make sense to hook [[mw:Manual:Hooks/TitleSquidURLs]] to get the list of URLs to purge?

It's certainly not how the hook is intended to be used (it's supposed to provide the list so extensions can add URLs) but the worst that can happen should be that extra URLs added by some other extension (depending on order called) miss getting purged. As the hook has only existed since MW 1.22, the number of affected extensions should be small.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 9 2015, 10:53 PM
ori set Security to None.Feb 16 2016, 10:59 PM
ori added a subscriber: aaron.

Such a hook should definitely be added.