CDN and caching
How public and private files are cached, and how a change reaches visitors.
| File | Cached where | For how long |
|---|---|---|
| public file | at the edge, shared by everyone | the bucket’s cacheControl, 1 hour by default |
| public image transform | at the edge | 30 days, keyed by the options |
| private file by signed URL | at the edge, for that URL only | until the URL expires |
| private file by token | not cached at the edge | — |
Replacing a file (upsert) invalidates its cached copies and its transforms. Clients that cache harder should use paths with a version (menu/v3/pan.jpg).
Range requests (Range: bytes=…) are supported, so video players can seek. ETag and If-None-Match make repeat requests cheap.
Your own address
Public files and image transforms are served on <ref>.files.sypnia.app from the start. To serve them on your own domain, connect an address with Sypnia Domains:
npx @sypnia/domains connect cdn.laespiga.co files:publicDomains writes the record and the certificate, and the same files answer on https://cdn.laespiga.co/menu/pan.jpg. Signed links can use the address too; the Files API stays on its own host. Use a subdomain made only for files, never the one your app runs on, so an uploaded file can never read your app’s cookies. A domain registered somewhere else connects the same way once Domains keeps its DNS (DNS only).