Consolidate disabling cache logic

This commit is contained in:
Daniel Hensby 2018-07-02 15:13:46 +01:00
parent f7f567a12e
commit c52be7fe09
No known key found for this signature in database
GPG Key ID: D8DEBC4C8E7BC8B9
1 changed files with 1 additions and 6 deletions

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