Skip to content

docs: Document the SPA and static cache control environment variables - #775

Open
developerjamiu wants to merge 2 commits into
mainfrom
docs/spa-static-cache-env
Open

docs: Document the SPA and static cache control environment variables#775
developerjamiu wants to merge 2 commits into
mainfrom
docs/spa-static-cache-env

Conversation

@developerjamiu

Copy link
Copy Markdown
Contributor

Companion to #756. The web server ships three cache-control environment variables built on the same mechanism; #756 documents the FlutterRoute one, and this adds the other two on their own pages:

  • SERVERPOD_WEB_SERVER_STATIC_CACHE_CONTROL on the Static files page, next to the cache-control helpers it substitutes for.
  • SERVERPOD_WEB_SERVER_SPA_CACHE_CONTROL on the Single-page apps page, including the two SpaRoute-specific rules: the fallback file is always served without a Cache-Control header, and the static variable does not apply to SpaRoute.

In all three cases an explicit cacheControlFactory takes precedence over the environment variable.

@developerjamiu developerjamiu self-assigned this Sep 1, 2026
@developerjamiu developerjamiu added the documentation Improvements or additions to documentation label Sep 1, 2026
);
```

To set the header per environment instead of in code, set `SERVERPOD_WEB_SERVER_STATIC_CACHE_CONTROL` to the `Cache-Control` value the route should send:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question - Have we listed these on the ENV page? What is the strategy around that currently?

@developerjamiu developerjamiu Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet (thanks for the catch). The reference only listed variables that also have a config-file option, and these three are env-only. I'll add all three (including #756's FlutterRoute one) to the table with links to their pages. Going forward the rule is: every SERVERPOD_* variable gets a row in the reference, and the full explanation lives on the feature's own page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants