mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-07 02:26:48 +00:00
have nginx cache index for 1s. (#224)
This is required for A B deployments, the browser wasn't updating due to conditional caches
This commit is contained in:
@@ -30,8 +30,10 @@ app.use(
|
||||
setHeaders: (res, path) => {
|
||||
// You can conditionally set different cache times based on file types
|
||||
if (path.endsWith(".html")) {
|
||||
// HTML files get shorter cache time
|
||||
res.setHeader("Cache-Control", "public, max-age=60");
|
||||
// Set HTML files to no-cache to ensure Express doesn't send 304s
|
||||
res.setHeader("Cache-Control", "no-cache, must-revalidate");
|
||||
res.setHeader("Pragma", "no-cache");
|
||||
res.setHeader("Expires", "0");
|
||||
} else if (path.match(/\.(js|css|svg)$/)) {
|
||||
// JS, CSS, SVG get long cache with immutable
|
||||
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
||||
|
||||
Reference in New Issue
Block a user