Add cache header to statics

pull/282/head
Amio 2019-06-07 10:54:04 +08:00
rodzic 3b8ee1084a
commit 36d6496912
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -27,7 +27,12 @@ const { PUB_DIR = '.' } = process.env
const server = http.createServer(async (req, res) => {
// handle statics
if (isStatic(req.url)) {
return serveHandler(req, res, { public: path.resolve(__dirname, PUB_DIR) })
return serveHandler(req, res, {
public: path.resolve(__dirname, PUB_DIR),
headers: [
{ "source": "**/*", "headers": "public, max-age: 86400, s-maxage: 86400" }
]
})
}
// handle `/docs/:name`