Krinkle has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/341733 )
Change subject: resourceloader: Add 1 minute stale-while-revalidate (Cache-control) ...................................................................... resourceloader: Add 1 minute stale-while-revalidate (Cache-control) Configure as 1 minute. Or half of the max age, if the lowest maxage is 2 minutes or less (e.g. in development mode). This gives popular resources a 1 minute grace window for a request to come in after it expired but still be served while the resource is asynchronously fetched for the next time. Web browsers do not support this yet as of writing, but various web proxies and CDNs do. Known to support stale-while-revalidate: * Varnish 4.1.0 (as default value of obj.grace) * Squid 2.7 * Fastly CDN Bug: T132418 Change-Id: Ifae1f09722be4abf1c4dfe895122a3503010a422 --- M includes/resourceloader/ResourceLoader.php 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/33/341733/1 diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 717fb45..582b8b6 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -857,7 +857,8 @@ header( 'Cache-Control: private, no-cache, must-revalidate' ); header( 'Pragma: no-cache' ); } else { - header( "Cache-Control: public, max-age=$maxage, s-maxage=$smaxage" ); + $grace = (int)min( 60, $maxage / 2, $smaxage / 2 ); + header( "Cache-Control: public, max-age=$maxage, s-maxage=$smaxage, stale-while-revalidate=$grace" ); $exp = min( $maxage, $smaxage ); header( 'Expires: ' . wfTimestamp( TS_RFC2822, $exp + time() ) ); } -- To view, visit https://gerrit.wikimedia.org/r/341733 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifae1f09722be4abf1c4dfe895122a3503010a422 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits