$wgUseXVO = false;
/** Add X-Forwarded-Proto to the Vary and X-Vary-Options headers for API
- * requests. Use this if you have an SSL termination setup and want to split
- * the cache between HTTP and HTTPS for API requests. This does not affect
- * 'regular' requests.
+ * requests and RSS/Atom feeds. Use this if you have an SSL termination setup
+ * and need to split the cache between HTTP and HTTPS for API and feed requests
+ * in order to prevent cache pollution. This does not affect 'normal' requests.
*/
$wgVaryOnXFPForAPI = false;
* but can also be called separately.
*/
public function httpHeaders() {
- global $wgOut;
+ global $wgOut, $wgVaryOnXFPForAPI;
# We take over from $wgOut, excepting its cache header info
$wgOut->disable();
$mimetype = $this->contentType();
header( "Content-type: $mimetype; charset=UTF-8" );
+ if ( $wgVaryOnXFPForAPI ) {
+ $wgOut->addVaryHeader( 'X-Forwarded-Proto' );
+ }
$wgOut->sendCacheControl();
}
$this->httpHeaders();
echo '<?xml version="1.0"?>' . "\n";
echo '<?xml-stylesheet type="text/css" href="' .
- htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion" ) ) .
+ htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion", PROTO_CURRENT ) ) .
'"?' . ">\n";
}
}