diff --git a/index.js b/index.js index 89afd7e..5765e15 100644 --- a/index.js +++ b/index.js @@ -141,6 +141,10 @@ function SendStream (req, path, options) { ? Boolean(opts.immutable) : false + this._revalidate = opts.revalidate !== undefined + ? Boolean(opts.revalidate) + : false + this._index = opts.index !== undefined ? normalizeList(opts.index, 'index option') : ['index.html'] @@ -866,6 +870,10 @@ SendStream.prototype.setHeader = function setHeader (path, stat) { cacheControl += ', immutable' } + if (this._revalidate) { + cacheControl += ', must-revalidate' + } + debug('cache-control %s', cacheControl) res.setHeader('Cache-Control', cacheControl) }