Caching
How browsers and the bunny.net CDN cache your files, and how to cache fingerprinted assets for longer.
Browsers get Cache-Control: public, max-age=0 for every file, so they check for a new version on every visit, as on Netlify, and a deploy shows up right away.
bunny.net still caches every file at its edge until the next deploy purges the cache. Most requests never reach the storage zone.
Fingerprinted assets
For files whose name changes with their content, such as the hashed assets of most build tools, set a long cache time in headers:
"headers": [
{ "for": "/assets/*", "values": { "Cache-Control": "public, max-age=31536000, immutable" } }
]
Use the directory your build tool writes them to, such as /_astro/* for Astro or /_next/static/* for a Next.js static export.
After a deploy, old fingerprinted scripts and styles stay available for pages that are still open on the previous version. See Version skew.
Edge caching
A Cache-Control from headers also applies to bunny.net’s edge. With max-age=0 or no-cache, every request for those files goes to the storage zone.