diff --git a/core/modules/page_cache/src/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php index 76852e3..f7432c2 100644 --- a/core/modules/page_cache/src/StackMiddleware/PageCache.php +++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php @@ -230,8 +230,9 @@ protected function fetch(Request $request, $type = self::MASTER_REQUEST, $catch return $response; } - $max_age = $response->getCacheableMetadata()->getCacheMaxAge(); - $expire = ($max_age === Cache::PERMANENT) ? Cache::PERMANENT : (int) $request->server->get('REQUEST_TIME') + $max_age; + // Use the actual timestamp from an Expires header, if available. + $date = $response->getExpires()->getTimestamp(); + $expire = ($date > time()) ? $date : Cache::PERMANENT; $this->set($request, $response, $expire, $response->getCacheableMetadata()->getCacheTags()); // Mark response as a cache miss.