diff --git a/config/nginx.conf b/config/nginx.conf index f3f8140e..e6f6e6be 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -8,7 +8,7 @@ server { location / { try_files $uri $uri/ /index.html; - add_header Cache-Control "no-store, no-cache, must-revalidate"; + add_header Cache-Control "public, max-age=30, stale-while-revalidate=30"; } # assets can be cached because they have hashed filenames diff --git a/public/index.html b/public/index.html index df1edfd9..e14d79be 100644 --- a/public/index.html +++ b/public/index.html @@ -3,6 +3,7 @@ + { - internalInstance.config = merge({}, DEFAULT_CONFIG, config); - }); + Config.internalInstance.initPromise = downloadConfig("/config.json").then( + (config) => { + internalInstance.config = merge({}, DEFAULT_CONFIG, config); + }, + ); } return Config.internalInstance.initPromise; } @@ -74,11 +74,7 @@ async function downloadConfig( configJsonFilename: string, ): Promise { const url = new URL(configJsonFilename, window.location.href); - url.searchParams.set("cachebuster", Date.now().toString()); - const res = await fetch(url, { - cache: "no-cache", - method: "GET", - }); + const res = await fetch(url); if (!res.ok || res.status === 404 || res.status === 0) { // Lack of a config isn't an error, we should just use the defaults.