diff --git a/src/runtime/static.ts b/src/runtime/static.ts index 9ae48a1bcc..0f611e4dc6 100644 --- a/src/runtime/static.ts +++ b/src/runtime/static.ts @@ -67,10 +67,11 @@ export default eventHandler((event) => { } const ifModifiedSinceH = event.node.req.headers["if-modified-since"]; + const mtimeDate = new Date(asset.mtime); if ( ifModifiedSinceH && asset.mtime && - new Date(ifModifiedSinceH) >= new Date(asset.mtime) + new Date(ifModifiedSinceH) >= mtimeDate ) { event.node.res.statusCode = 304; event.node.res.end(); @@ -86,7 +87,7 @@ export default eventHandler((event) => { } if (asset.mtime && !event.node.res.getHeader("Last-Modified")) { - event.node.res.setHeader("Last-Modified", asset.mtime); + event.node.res.setHeader("Last-Modified", mtimeDate.toUTCString()); } if (asset.encoding && !event.node.res.getHeader("Content-Encoding")) {