diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-02-11 22:14:04 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-02-16 11:35:57 +0100 |
commit | 7dddbd0c355d1b4761466f9f86b30aed8b112ba1 (patch) | |
tree | b782783ff0b88277e79a5ce3b5115f47a4b240f0 /core/Controller | |
parent | fbbbc2ec3445aa777f56c97a0a383a2e8566be54 (diff) | |
download | nextcloud-server-7dddbd0c355d1b4761466f9f86b30aed8b112ba1.tar.gz nextcloud-server-7dddbd0c355d1b4761466f9f86b30aed8b112ba1.zip |
Improve caching policy
* Cache css with version in url. This makes most js and css requests to
be cached by the browser
* Force caching previews, the etag is in the url so that if the propfind
gives a new etag, we will refresh it otherwise it's no use to try to
fetch the new etag and do tons of DB queries
Tested with firefox and 'debug' => false (important so that the js/css
urls are generated with ?v= parameter)
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'core/Controller')
-rw-r--r-- | core/Controller/PreviewController.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 1224ea39877..30b0a45c13d 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -167,8 +167,10 @@ class PreviewController extends Controller { try { $f = $this->preview->getPreview($node, $x, $y, !$a, $mode); - $response = new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); - $response->cacheFor(3600 * 24); + $response = new FileDisplayResponse($f, Http::STATUS_OK, [ + 'Content-Type' => $f->getMimeType(), + ]); + $response->cacheFor(3600 * 24, false, true); return $response; } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); |