From: Chocobozzz Date: Tue, 17 Jul 2018 17:04:41 +0000 (+0200) Subject: Fix static avatars/thumbnails cache X-Git-Tag: v1.0.0-beta.10.pre.1~41 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=57a81ff649fa8c0d17505e4a7c5ab1001887b22a;p=oweals%2Fpeertube.git Fix static avatars/thumbnails cache --- diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 1600068e0..8de9c5a78 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -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', diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 3837f7062..b11f0753f 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -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 = { diff --git a/support/nginx/peertube b/support/nginx/peertube index 0e77f6ae4..f28f26f7a 100644 --- a/support/nginx/peertube +++ b/support/nginx/peertube @@ -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; }