Skip to content

Commit

Permalink
added cache_max_age option
Browse files Browse the repository at this point in the history
  • Loading branch information
dickeyxxx committed May 29, 2015
1 parent 46d710e commit f8ad7f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions conf/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions lib/index-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f8ad7f2

Please sign in to comment.