Server: add cache to static files
authorChocobozzz <florian.bigard@gmail.com>
Fri, 21 Oct 2016 10:24:29 +0000 (12:24 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 21 Oct 2016 10:24:29 +0000 (12:24 +0200)
server.js

index b2d9be9aaff5f87c263ef0bf953a35d509081477..f24b25f4d96fc1501c38349563ef6d56fe75bcd1 100644 (file)
--- a/server.js
+++ b/server.js
@@ -75,15 +75,15 @@ app.use('/client/*', function (req, res, next) {
 })
 
 const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents'))
-app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: 0 }))
+app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: '7d' }))
 
 // Videos path for webseeding
 const videosPhysicalPath = path.join(__dirname, config.get('storage.videos'))
-app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: 0 }))
+app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: '7d' }))
 
 // Thumbnails path for express
 const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails'))
-app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: 0 }))
+app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: '7d' }))
 
 // Client application
 app.use('/*', function (req, res, next) {