diff --git a/core/modules/page_cache/src/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php index 69c1f19..1ff11b3 100644 --- a/core/modules/page_cache/src/StackMiddleware/PageCache.php +++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php @@ -252,16 +252,12 @@ protected function fetch(Request $request, $type = self::MASTER_REQUEST, $catch $expire = 0; // 403 and 404 responses can fill non-LRU cache backends and generally are // likely to have a low cache hit rate. So do not cache them permanently. - if ($response->isNotFound() || $response->isForbidden()) { - // Cache for an hour by default, or the max age, whichever is the smaller. - // If the ttl is set to 0 then do not cache it. + if ($response->isClientError()) { + // Cache for an hour by default. If the ttl is set to 0 then do not cache + // the response $settings_ttl = Settings::get('negative_cache_ttl', 3600); if ($settings_ttl > 0) { - $max_age = $response->getMaxAge(); - // The response's max_age will be negative in the case the response has - // no time set. - $ttl = ($max_age > 0) ? min($max_age, $settings_ttl) : $settings_ttl; - $expire = REQUEST_TIME + $ttl; + $expire = REQUEST_TIME + $settings_ttl; } } else { diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 266e7e4..ffce53e 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -422,7 +422,7 @@ /** - * Cache TTL for 403 and 404 responses. + * Cache TTL for client error (4xx) responses. * * Items cached per-URL tend to result in a large number of cache items, and * this can be problematic on 404 pages which by their nature are unbounded. A