diff options
Diffstat (limited to 'server.mjs')
| -rw-r--r-- | server.mjs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -157,7 +157,9 @@ function serveFile(res, path) { res.writeHead(404).end("not found") return } - res.writeHead(200, { "Content-Type": MIME[extname(path)] || "application/octet-stream", "Cache-Control": "max-age=300" }) + const type = MIME[extname(path)] || "application/octet-stream" + const cache = path.endsWith(".html") ? "no-cache" : "max-age=300" + res.writeHead(200, { "Content-Type": type, "Cache-Control": cache }) createReadStream(path).pipe(res) } |
