From 3116b1f97c7afa23eb4019e5f0a62e0e64da91db Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Mon, 2 Jul 2018 15:13:46 +0100 Subject: [PATCH] Consolidate disabling cache logic --- src/Control/Middleware/HTTPCacheControlMiddleware.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Control/Middleware/HTTPCacheControlMiddleware.php b/src/Control/Middleware/HTTPCacheControlMiddleware.php index 36b2f56ac..572e6fb2b 100644 --- a/src/Control/Middleware/HTTPCacheControlMiddleware.php +++ b/src/Control/Middleware/HTTPCacheControlMiddleware.php @@ -771,14 +771,9 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable } // Errors disable cache (unless some errors are cached intentionally by usercode) - if ($response->isError()) { + if ($response->isError() || $response->isRedirect()) { // Even if publicCache(true) is specified, errors will be uncacheable $this->disableCache(true); } - - // Don't cache redirects - if ($response->isRedirect()) { - $this->disableCache(true); - } } }