Skip to content

Commit

Permalink
Currently, files which fail to match contentTypeMatch are served with…
Browse files Browse the repository at this point in the history
… the underlying connect.static.send which defaults to maxAge=0 (i.e. they are immediately stale). This has the undesirable consequence that any image files served by gZippo are thus never cached by the browser (the browser does reuse the file, but it always queries the server with an If-Modified-Since).


With this change, we use gZippo's maxAge value when 'pass'ing to connect.

This brings up an interesting issue of whether gZippo is intended solely for gzippable content ... or whether it should try to replicate normal 'static' middleware behavior for other content types (e.g. images). It might be interesting to contemplate using the same 'options' format for gZippo as the underlying connect middleware for maximum overlap.
  • Loading branch information
mdrcode committed Aug 17, 2011
1 parent 8ba40c2 commit db015ca
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/staticGzip.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ exports = module.exports = function staticGzip(dirPath, options){
function pass(name) {
var o = Object.create(options);
o.path = name;
o.maxAge = maxAge;
staticSend(req, res, next, o);
}

Expand Down

0 comments on commit db015ca

Please sign in to comment.