CDN
The caching strategy must always be controlled by the origin (i.e., the application itself). There must be no dependency on the default settings of the CDN.
Requirements
- All GET requests (Site and API) must explicitly set a Cache-Control header (see Cache-Control header - HTTP | MDN).
- Caching duration: The lifetime of assets should be chosen appropriately depending on the content (e.g., for static assets with Cache Buster: long validity with
immutable
; for API responses: short validity orno-store
). - Comet: Header setting is already ensured for all routes.
Background
Proper control of cache lifetime not only improves loading speed but also affects SEO (see e.g., Serve static assets with an efficient cache policy | Lighthouse | Chrome for Developers).