From de50903d21569c50fae59efc2e42f595528aa827 Mon Sep 17 00:00:00 2001 From: Marcelo Soares Date: Tue, 18 Aug 2026 11:36:33 -0300 Subject: [PATCH] docs: Document the FlutterRoute cache control environment variable --- docs/06-concepts/05-web-server/08-flutter-web.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/06-concepts/05-web-server/08-flutter-web.md b/docs/06-concepts/05-web-server/08-flutter-web.md index 9a922683..42f76447 100644 --- a/docs/06-concepts/05-web-server/08-flutter-web.md +++ b/docs/06-concepts/05-web-server/08-flutter-web.md @@ -86,6 +86,14 @@ pod.webServer.addRoute( A custom factory applies to all files served from the directory. The fallback-served `index.html` (a client-side route like `/dashboard`) always gets no-cache headers, but a direct request to `/index.html` follows your factory, so exclude `index.html` from long-lived caching in a custom strategy. ::: +To set the header per environment instead of in code, set `SERVERPOD_WEB_SERVER_FLUTTER_CACHE_CONTROL` to the `Cache-Control` value the route should send: + +```bash +SERVERPOD_WEB_SERVER_FLUTTER_CACHE_CONTROL="public, max-age=3600" +``` + +The environment variable applies to every `FlutterRoute` that does not pass a `cacheControlFactory` of its own, and the same warning applies to it. + See [Static files](static-files#cache-control) for more on cache control. ### Cache busting