1
0
Fork 0

Fix static avatars/thumbnails cache

This commit is contained in:
Chocobozzz 2018-07-17 19:04:41 +02:00
parent 57bf30a984
commit 57a81ff649
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 4 additions and 3 deletions

View File

@ -31,7 +31,7 @@ const videosPhysicalPath = CONFIG.STORAGE.VIDEOS_DIR
staticRouter.use( staticRouter.use(
STATIC_PATHS.WEBSEED, STATIC_PATHS.WEBSEED,
cors(), cors(),
express.static(videosPhysicalPath, { maxAge: STATIC_MAX_AGE }) express.static(videosPhysicalPath)
) )
staticRouter.use( staticRouter.use(
STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension', STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension',

View File

@ -429,7 +429,7 @@ const STATIC_DOWNLOAD_PATHS = {
} }
// Cache control // Cache control
let STATIC_MAX_AGE = '30d' let STATIC_MAX_AGE = '2h'
// Videos thumbnail size // Videos thumbnail size
const THUMBNAILS_SIZE = { const THUMBNAILS_SIZE = {

View File

@ -57,7 +57,8 @@ server {
} }
location ~ ^/static/(thumbnails|avatars)/(.*)$ { 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; alias /var/www/peertube/storage/$1/$2;
} }