Prompt
How do I configure purge and versioning so users always get the latest files?
Latest observation
Oct 14, 2026
OpenAI APIWeb search: off
To make sure users always get the latest files, you generally want to enable versioning and use purge/invalidation in your delivery layer so old cached content is removed or bypassed.
Recommended setup
1) Turn on versioning for files
Use a versioned filename or URL, for example:
app.js?v=20261014app.abc123.jsstyles.4f8d2c.css
This ensures each new release has a new URL, so users and caches fetch the new file automatically.
2) Configure cache purge/invalidation
When you update a file, purge the old cached object from your CDN/cache.
Common approaches:
- Purge by URL: remove the exact old file URL
- Purge by prefix/path: remove all files under
/assets/ - Purge all: only if necessary, since it’s less efficient
3) Set cache headers appropriately
For versioned assets, use long cache lifetimes:
Cache-Control: public, max-age=31536000, immutable
For non-versioned files that must always stay current:
Cache-Control: no-cacheormax-age=0, must-revalidate
4) Don’t overwrite versioned assets
Best practice is:
- Upload new files with new names/versions
- Keep old versions available until caches expire or are purged
- Update references in your app/site to the new versioned URLs
Example workflow
- Build creates
main.8c1f2a.js - Upload it to storage/CDN
- Update HTML/app config to point to
main.8c1f2a.js - Purge old HTML or relevant manifest if needed
- Users request the new URL and get the latest file
If you mean a specific platform
If you’re configuring this in something like:
- CloudFront
- Fastly
- Cloudflare
- Akamai
- S3 static hosting
- Azure CDN
tell me which one, and I can give you the exact purge/versioning settings and example configuration.