core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php index 715461a..7b7ca80 100644 --- a/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php @@ -96,6 +96,12 @@ protected function finish(array $html) { return parent::finish($html); } + // Don't cache routes that have marked themselves as uncacheable. + // @see \Drupal\Core\PageCache\ResponsePolicy\DenyNoCacheRoutes + if ($this->routeMatch->getRouteObject()->getOption('no_cache')) { + return parent::finish($html); + } + // @todo For now, SmartCache doesn't handle admin routes. It may be too much // work to add the necessary cacheability metadata to all admin routes // before 8.0.0, but that can happen in 8.1.0 without a BC break.