diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index f4cd517..c12b252 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -10,6 +10,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Symfony\Component\HttpFoundation\BinaryFileResponse; +use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -102,8 +103,8 @@ public function onRespond(FilterResponseEvent $event) { } $max_age = \Drupal::config('system.performance')->get('cache.page.max_age'); - $is_binary_file_response = ($response instanceof BinaryFileResponse); - if ($max_age > 0 && !$is_binary_file_response && ($cache = drupal_page_set_cache($response, $request))) { + $is_uncacheable_file_response = ($response instanceof BinaryFileResponse || $response instanceof StreamedResponse); + if ($max_age > 0 && !$is_uncacheable_file_response && ($cache = drupal_page_set_cache($response, $request))) { $response->headers->set('X-Drupal-Cache', 'MISS'); drupal_serve_page_from_cache($cache, $response, $request); }