mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX If theres a max-age set remove no-cache and no-store
This commit is contained in:
parent
92f5ef31d8
commit
399ebd0031
@ -522,6 +522,10 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable
|
||||
// Affect all non-disabled states
|
||||
$applyTo = [self::STATE_ENABLED, self::STATE_PRIVATE, self::STATE_PUBLIC, self::STATE_DEFAULT];
|
||||
$this->setStateDirective($applyTo, 'max-age', $age);
|
||||
if ($age) {
|
||||
$this->removeStateDirective($applyTo, 'no-cache');
|
||||
$this->removeStateDirective($applyTo, 'no-store');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -538,6 +542,10 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable
|
||||
// Affect all non-disabled states
|
||||
$applyTo = [self::STATE_ENABLED, self::STATE_PRIVATE, self::STATE_PUBLIC, self::STATE_DEFAULT];
|
||||
$this->setStateDirective($applyTo, 's-maxage', $age);
|
||||
if ($age) {
|
||||
$this->removeStateDirective($applyTo, 'no-cache');
|
||||
$this->removeStateDirective($applyTo, 'no-store');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user