mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Allow setNoCache(false) to remove no-cache directive
This commit is contained in:
parent
18b7dc235a
commit
92f5ef31d8
@ -499,7 +499,13 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable
|
||||
{
|
||||
// Affect all non-disabled states
|
||||
$applyTo = [self::STATE_ENABLED, self::STATE_PRIVATE, self::STATE_PUBLIC];
|
||||
$this->setStateDirective($applyTo, 'no-cache', $noCache);
|
||||
if ($noCache) {
|
||||
$this->setStateDirective($applyTo, 'no-cache');
|
||||
$this->removeStateDirective($applyTo, 'max-age');
|
||||
$this->removeStateDirective($applyTo, 's-maxage');
|
||||
} else {
|
||||
$this->removeStateDirective($applyTo, 'no-cache');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user