Commit 89854ad0 authored by Pooya Parsa's avatar Pooya Parsa

http2 push and cache-control age

parent bd183e00
...@@ -4,7 +4,7 @@ import apicache from "apicache" ...@@ -4,7 +4,7 @@ import apicache from "apicache"
const app = express() const app = express()
// https://github.com/kwhitley/apicache // https://github.com/kwhitley/apicache
app.use(apicache.middleware("5 minutes")) app.use(apicache.middleware("15 minutes"))
// apicache.options({ debug: true }) // apicache.options({ debug: true })
......
...@@ -33,11 +33,14 @@ export default { ...@@ -33,11 +33,14 @@ export default {
plugins: ["~/plugins/filters"], plugins: ["~/plugins/filters"],
serverMiddleware: ["~/common/cache.js"], serverMiddleware: ["~/common/cache.js"],
render: { render: {
http2: {
push: true
},
static: { static: {
maxAge: "1y", maxAge: "1y",
setHeaders(res, path) { setHeaders(res, path) {
if (path.includes("sw.js")) { if (path.includes("sw.js")) {
res.setHeader("Cache-Control", "public, max-age=0") res.setHeader("Cache-Control", `public, max-age=${15 * 60}`)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment