perf: optimize launcher boot and media loading
This commit is contained in:
+13
-1
@@ -1543,7 +1543,19 @@ if (process.env.NODE_ENV === "production") {
|
||||
throw new Error("Launcher production build is missing. Run npm run build before starting the server.");
|
||||
}
|
||||
|
||||
app.use(express.static(distRoot, { index: false }));
|
||||
app.use(express.static(distRoot, {
|
||||
index: false,
|
||||
immutable: true,
|
||||
maxAge: "1y",
|
||||
setHeaders(res, assetPath) {
|
||||
if (assetPath === indexHtmlPath) {
|
||||
res.setHeader("Cache-Control", noStoreCacheControl);
|
||||
return;
|
||||
}
|
||||
|
||||
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
||||
},
|
||||
}));
|
||||
app.use((req, res, next) => {
|
||||
if (req.method !== "GET" && req.method !== "HEAD") {
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user