diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-02-28 11:17:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 11:17:00 +0100 |
commit | d1e87ad35c06248637d4b7a8c7f3042e0cb48d65 (patch) | |
tree | 6c3a8f8360c76502d9559a82cb349c7a05f683a3 /lib | |
parent | 31c78dd0a84b1dbd725c29ef4dcbeacb3cc92d03 (diff) | |
parent | f6d0bb419ede2acf2c7ef0e42d1647ff56bee085 (diff) | |
download | nextcloud-server-d1e87ad35c06248637d4b7a8c7f3042e0cb48d65.tar.gz nextcloud-server-d1e87ad35c06248637d4b7a8c7f3042e0cb48d65.zip |
Merge pull request #31244 from nextcloud/backport/31141/stable23
[stable23] Improve caching policy use immutable when loading versionned assets
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/AppFramework/Http/Response.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index ee10d483b25..1a84affbe57 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -103,10 +103,10 @@ class Response { * @return $this * @since 6.0.0 - return value was added in 7.0.0 */ - public function cacheFor(int $cacheSeconds, bool $public = false) { + public function cacheFor(int $cacheSeconds, bool $public = false, bool $immutable = false) { if ($cacheSeconds > 0) { $pragma = $public ? 'public' : 'private'; - $this->addHeader('Cache-Control', $pragma . ', max-age=' . $cacheSeconds . ', must-revalidate'); + $this->addHeader('Cache-Control', sprintf('%s, max-age=%s, %s', $pragma, $cacheSeconds, ($immutable ? 'immutable' : 'must-revalidate'))); $this->addHeader('Pragma', $pragma); // Set expires header |