Consolidate disabling cache logic

This commit is contained in:
Daniel Hensby 2018-07-02 15:13:46 +01:00
parent b9b1a74b92
commit 3116b1f97c
No known key found for this signature in database
GPG Key ID: D8DEBC4C8E7BC8B9

View File

@ -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);
}
}
}