Fix static avatars/thumbnails cache
authorChocobozzz <me@florianbigard.com>
Tue, 17 Jul 2018 17:04:41 +0000 (19:04 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 17 Jul 2018 17:04:41 +0000 (19:04 +0200)
server/controllers/static.ts
server/initializers/constants.ts
support/nginx/peertube

index 1600068e0c383edd99af184fab11da76cc9e3d96..8de9c5a78e4359446071e9289e171df39809cb4e 100644 (file)
@@ -31,7 +31,7 @@ const videosPhysicalPath = CONFIG.STORAGE.VIDEOS_DIR
 staticRouter.use(
   STATIC_PATHS.WEBSEED,
   cors(),
-  express.static(videosPhysicalPath, { maxAge: STATIC_MAX_AGE })
+  express.static(videosPhysicalPath)
 )
 staticRouter.use(
   STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension',
index 3837f7062ac2b5d092771d67f525d6a60f673592..b11f0753f1a0960092eea81cd421529a01441953 100644 (file)
@@ -429,7 +429,7 @@ const STATIC_DOWNLOAD_PATHS = {
 }
 
 // Cache control
-let STATIC_MAX_AGE = '30d'
+let STATIC_MAX_AGE = '2h'
 
 // Videos thumbnail size
 const THUMBNAILS_SIZE = {
index 0e77f6ae4ba8c774a8f4aaa43cd139ae346d602f..f28f26f7aaaf5378b687d6faf18af89a5526755e 100644 (file)
@@ -57,7 +57,8 @@ server {
   }
 
   location ~ ^/static/(thumbnails|avatars)/(.*)$ {
-    add_header Cache-Control "public, max-age=31536000, immutable";
+    # Cache 2 hours
+    add_header Cache-Control "public, max-age=7200";
 
     alias /var/www/peertube/storage/$1/$2;
   }