mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
add cache-busting
This commit is contained in:
@@ -72,6 +72,20 @@ app.use("/vault-files", (req, res, next) => {
|
||||
express.static(vaultPath)(req, res, next);
|
||||
});
|
||||
|
||||
// Serve dist files with cache headers based on version param
|
||||
app.use((req, res, next) => {
|
||||
if (req.path.match(/\/(ignis-ui|shim-loader)\.js$/)) {
|
||||
if (req.query.v) {
|
||||
// Versioned assets - cache for 1 year
|
||||
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
||||
} else {
|
||||
// No version param - short cache for dev/fallback
|
||||
res.setHeader("Cache-Control", "public, max-age=300");
|
||||
}
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(express.static(path.join(__dirname, "..", "dist")));
|
||||
|
||||
app.use(express.static(config.obsidianAssetsPath));
|
||||
|
||||
Reference in New Issue
Block a user