diff --git a/core/lib/Drupal/Core/StackMiddleware/PageCache.php b/core/lib/Drupal/Core/StackMiddleware/PageCache.php index d4ec291..f8a6aa4 100644 --- a/core/lib/Drupal/Core/StackMiddleware/PageCache.php +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php @@ -323,6 +323,12 @@ protected function getCacheId(Request $request) { $request->getUri(), $request->getRequestFormat(), ); + $header_contexts = explode(' ', $response->headers->get('X-Drupal-Cache-Contexts')); + if (!empty($header_contexts)) { + $contexts = $this->cacheContexts->convertTokensToKeys($header_contexts); + $cid_parts = array_merge($cid_parts, $contexts); + } + return implode(':', $cid_parts); }