Only add date if date exists.
This commit is contained in:
parent
ff264aa69a
commit
494ca0560b
|
@ -55,13 +55,15 @@ exports.minifyJS = function(req, res, next)
|
||||||
res.header("Content-Type","text/javascript");
|
res.header("Content-Type","text/javascript");
|
||||||
|
|
||||||
statFile(filename, function (error, date, exists) {
|
statFile(filename, function (error, date, exists) {
|
||||||
date = new Date(date);
|
if (date) {
|
||||||
res.setHeader('last-modified', date.toUTCString());
|
date = new Date(date);
|
||||||
res.setHeader('date', (new Date()).toUTCString());
|
res.setHeader('last-modified', date.toUTCString());
|
||||||
if (server.maxAge) {
|
res.setHeader('date', (new Date()).toUTCString());
|
||||||
var expiresDate = new Date((new Date()).getTime() + server.maxAge*1000);
|
if (server.maxAge) {
|
||||||
res.setHeader('expires', expiresDate.toUTCString());
|
var expiresDate = new Date((new Date()).getTime()+server.maxAge*1000);
|
||||||
res.setHeader('cache-control', 'max-age=' + server.maxAge);
|
res.setHeader('expires', expiresDate.toUTCString());
|
||||||
|
res.setHeader('cache-control', 'max-age=' + server.maxAge);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in New Issue