diff --git a/conf/full.yaml b/conf/full.yaml index b8c34418..c701de68 100644 --- a/conf/full.yaml +++ b/conf/full.yaml @@ -125,3 +125,5 @@ logs: # and the highest semver is placed instead. #ignore_latest_tag: false +# Enable a Cache-Control max-age header +#cache_max_size: 600 diff --git a/lib/index-api.js b/lib/index-api.js index 58aa50ef..fd8bfdc5 100644 --- a/lib/index-api.js +++ b/lib/index-api.js @@ -52,6 +52,10 @@ module.exports = function(config, auth, storage) { if (err) return next(err) info = Utils.filter_tarball_urls(info, req, config) + if (config.cache_max_age) { + res.header('Cache-Control', 'public, max-age=' + config.cache_max_age) + } + var version = req.params.version if (!version) return next(info)