diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 67e9a4ff82b9..d8600c1ef554 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2026,6 +2026,11 @@ public function addVaryHeader( $header, array $option = null ) { * @return string */ public function getVaryHeader() { + // If we vary on cookies, let's make sure it's always included here too. + if ( $this->getCacheVaryCookies() ) { + $this->addVaryHeader( 'Cookie' ); + } + foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) { $this->addVaryHeader( $header, $options ); } diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index c7b18a4ba1d3..5bf24f60e683 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -80,6 +80,12 @@ function onView() { } } + // Set standard Vary headers so cache varies on cookies and such (T125283) + $response->header( $this->getOutput()->getVaryHeader() ); + if ( $config->get( 'UseKeyHeader' ) ) { + $response->header( $this->getOutput()->getKeyHeader() ); + } + $response->header( 'Content-type: ' . $contentType . '; charset=UTF-8' ); // Output may contain user-specific data; // vary generated content for open sessions on private wikis