diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index fdd2a91..9431cea 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -98,7 +98,9 @@ public function onAllResponds(FilterResponseEvent $event) { $response = $event->getResponse(); // Always add the 'http_response' cache tag to be able to invalidate every // response. - $response->getCacheableMetadata()->addCacheTags(['http_response']); + if ($response instanceof CacheableResponseInterface) { + $response->getCacheableMetadata()->addCacheTags(['http_response']); + } } /**