How it works · s5w

Caching

The Cache-Control header is built for every delivery from the bucket policy, the folder policy and the lifetime of the file itself.

Visibility

visibility Name Cache-Control Who caches
1 SHARED public, max-age=…, immutable the browser and the CDN
2 PRIVATE private, max-age=… the browser only
3 NO_STORE no-store no one

Where the values come from

  1. Folder

    If the folder has its own policy (PATCH /v1/folders/{name}/cache), that one is used.

  2. Bucket

    Otherwise — the bucket policy, set in the panel.

  3. Environment

    If max-age is set nowhere — CACHE_DEFAULT_MAX_AGE (86400) for SHARED and CACHE_PRIVATE_MAX_AGE (0) for PRIVATE.

Rules on top

  • A non-public file and the /p, /t channels — never above PRIVATE: such a response must not end up in a shared CDN cache.
  • max-age no longer than the lifetime. If the file has a retention period or the delivery goes through a temporary link, max-age is cut down to the time left.
  • max-age=0 becomes max-age=0, must-revalidate — the cache must ask again, and ETag makes such a request cheap (304).

immutable

The content at an address never changes — a new version gets a new id. That is why a large max-age is safe for SHARED: immutable also spares repeated revalidation.