Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Commit

Permalink
Only remove headers when handling a cachify request. Doh. Fixes Issue#9
Browse files Browse the repository at this point in the history
  • Loading branch information
ozten committed Feb 17, 2012
1 parent b6957c4 commit 9f6af01
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/connect-cachify.js
Expand Up @@ -87,14 +87,14 @@ exports.setup = function (assets, options) {
resp.setHeader('Cache-Control', 'public, max-age=31536000');
req.url = true_path;
}
}
resp.on('header', function () {
// Relax other middleware... I got this one
['ETag', 'Last-Modified'].forEach(function (header) {
if (resp.getHeader(header)) resp.removeHeader(header);
if (resp.getHeader(header)) resp.removeHeader(header);
resp.on('header', function () {
// Relax other middleware... I got this one
['ETag', 'Last-Modified'].forEach(function (header) {
if (resp.getHeader(header)) resp.removeHeader(header);
if (resp.getHeader(header)) resp.removeHeader(header);
});
});
});
}
next();
};
};
Expand Down

2 comments on commit 9f6af01

@lloyd
Copy link
Contributor

@lloyd lloyd commented on 9f6af01 Feb 17, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r- if I'm reading the code right, this still looks wrong to me. I think we only want to manipulate headers if exists === true. resp.on should probably be at the same place where we set max-age=31536000?

@ozten
Copy link
Contributor Author

@ozten ozten commented on 9f6af01 Feb 17, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

Fixed. Published 0.0.6.

:)

Please sign in to comment.