diff --git a/.env.example b/.env.example index f2ee9df..62b28cf 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,7 @@ DATA_CACHING=false DATA_PRECACHING=false PAGE_CACHING=false PAGE_PRECACHING=false +CACHE_CONTROL=false ## OPEN EXCHANGE RATE OER_APP_ID=oerappid5e6ea45ef4e66eaa151612bdcb599df diff --git a/TODO.md b/TODO.md index 15aaa4b..7bea2c9 100644 --- a/TODO.md +++ b/TODO.md @@ -2,8 +2,7 @@ ## Ongoing -- [Bugs] No post processing on the 404 page - +- [Bugs] It's possible to save a page with empty Line or Cue - [Bugs] Keziah reported some lag spikes when scrolling on the home page (Firefox on Windows) - [Feat] [Analytics] Add analytics - [Bugs] [Tooltips] Tooltip in under next element (example in timeline) diff --git a/src/middleware/commonHeaders.ts b/src/middleware/commonHeaders.ts index 849733d..3ae251d 100644 --- a/src/middleware/commonHeaders.ts +++ b/src/middleware/commonHeaders.ts @@ -12,7 +12,12 @@ export const addCommonHeadersMiddleware = defineMiddleware(async ({ url }, next) // TODO: Remove when in production response.headers.set("X-Robots-Tag", "none"); response.headers.set("Vary", "Cookie"); - response.headers.set("Cache-Control", "max-age=86400, stale-while-revalidate=86400"); + + if (import.meta.env.CACHE_CONTROL !== "true") { + response.headers.set("Cache-Control", "no-store"); + } else { + response.headers.set("Cache-Control", "max-age=86400, stale-while-revalidate=86400"); + } return response; });