diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index b8c86b2..2bbfeaa 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -121,10 +121,7 @@ public function onRespond(FilterResponseEvent $event) { // another place. if (!($response instanceof CacheableResponseInterface)) { if (!$this->isCacheControlCustomized($response)) { - $expire_header = $response->headers->get('Expires'); - if (!$expire_header) { - $this->setExpiresNoCache($response); - } + $this->setResponseNotCacheable($response, $request); } return; } diff --git a/core/modules/image/tests/modules/image_module_test/image_module_test.module b/core/modules/image/tests/modules/image_module_test/image_module_test.module index df71375..7be617e 100644 --- a/core/modules/image/tests/modules/image_module_test/image_module_test.module +++ b/core/modules/image/tests/modules/image_module_test/image_module_test.module @@ -10,7 +10,11 @@ function image_module_test_file_download($uri) { $default_uri = \Drupal::state()->get('image.test_file_download') ?: FALSE; if ($default_uri == $uri) { - return array('X-Image-Owned-By' => 'image_module_test'); + return [ + 'X-Image-Owned-By' => 'image_module_test', + 'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0', + 'Expires' => \DateTime::createFromFormat('j-M-Y H:i:s T', '19-Nov-1978 05:00:00 GMT')->format('D, d M Y H:i:s T'), + ]; } }