Skip to content

Commit dd81fad

Browse files
committed
PicoAssetResponse::cacheFor(): Add $immutable parameter
See nextcloud/server#31141 Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
1 parent f3f1d25 commit dd81fad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Http/PicoAssetResponse.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ public function setContentSecurityPolicy(EmptyContentSecurityPolicy $csp): self
102102
*
103103
* @return $this
104104
*/
105-
public function cacheFor(int $cacheSeconds, bool $public = false): self
105+
public function cacheFor(int $cacheSeconds, bool $public = false, bool $immutable = false): self
106106
{
107107
if ($cacheSeconds > 0) {
108108
$pragma = $public ? 'public' : 'private';
109-
$this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', ' . $pragma);
109+
$maxAge = 'max-age=' . $cacheSeconds;
110+
111+
$this->addHeader('Cache-Control', $pragma . ',' . $maxAge . ($immutable ? ', immutable' : ''));
110112
$this->addHeader('Pragma', $pragma);
111113

112114
try {

0 commit comments

Comments
 (0)