diff --git a/core/server/middleware/middleware.js b/core/server/middleware/middleware.js index 37bc060175..e0bef78d6b 100644 --- a/core/server/middleware/middleware.js +++ b/core/server/middleware/middleware.js @@ -10,7 +10,8 @@ var _ = require('lodash'), api = require('../api'), expressServer, - ONE_HOUR_MS = 60 * 60 * 1000; + ONE_HOUR_MS = 60 * 60 * 1000, + ONE_YEAR_MS = 365 * 24 * ONE_HOUR_MS; function isBlackListedFileType(file) { var blackListedFileTypes = ['.hbs', '.md', '.json'], @@ -172,8 +173,8 @@ var middleware = { forwardToExpressStatic: function (req, res, next) { api.settings.read({context: {internal: true}, key: 'activeTheme'}).then(function (response) { var activeTheme = response.settings[0]; - // For some reason send divides the max age number by 1000 - express['static'](path.join(config().paths.themePath, activeTheme.value), {maxAge: ONE_HOUR_MS})(req, res, next); + + express['static'](path.join(config().paths.themePath, activeTheme.value), {maxAge: ONE_YEAR_MS})(req, res, next); }); }, @@ -191,4 +192,4 @@ var middleware = { }; module.exports = middleware; -module.exports.cacheServer = cacheServer; \ No newline at end of file +module.exports.cacheServer = cacheServer; diff --git a/core/test/functional/routes/frontend_test.js b/core/test/functional/routes/frontend_test.js index e86332ea18..cb8c053ca4 100644 --- a/core/test/functional/routes/frontend_test.js +++ b/core/test/functional/routes/frontend_test.js @@ -401,7 +401,7 @@ describe('Frontend Routing', function () { it('should retrieve theme assets', function (done) { request.get('/assets/css/screen.css') - .expect('Cache-Control', cacheRules.hour) + .expect('Cache-Control', cacheRules.year) .expect(200) .end(doEnd(done)); });