
When you deploy single-page apps or static websites to an S3-compatible bucket, you have two ways to roll out new JavaScript, CSS, and media bundles. You can keep filenames fixed (<code>bundle.js</code>) and purge CDN edge caches on every deployment. Or you can embed cryptographic content hashes into filenames (<code>bundle.8d3f1a.js</code>) with a one-year immutable cache header, updating only your entry HTML.
We benchmarked both workflows across eight edge POP locations. Content hashing won on every metric: zero edge purge delay, zero invalidation fees, and a 99.8% CDN cache hit ratio compared to 94.2% for fixed filenames with cache invalidation.
The benchmark: content hashes vs fixed-name purging
We simulated 100 consecutive production deploys over 30 days serving 2.4 million total asset requests across edge locations in Frankfurt, London, New York, San Jose, Singapore, Tokyo, Sydney, and São Paulo:
| Benchmark metric | Content-hashed assets (bundle.[hash].js) | Fixed names + CDN purge (bundle.js) | Performance impact |
|---|---|---|---|
| CDN cache hit ratio | 99.8% | 94.2% | 5.6% hit penalty from repeated purges |
| Purge propagation lag | 0 seconds (atomic deploy) | 30s – 180s | Global POP propagation delay eliminated |
| Edge invalidation cost | $0.00 / month | $5.00 / 10k paths | Zero purge API charges on automated CI/CD |
| Stale asset exposure | 0 users (exact version in HTML) | Split-brain during purge window | No mismatched JS / CSS chunk errors |
| Origin GET requests | 4,800 requests (0.2%) | 139,200 requests (5.8%) | 29x fewer requests hitting origin bucket |
| Rollback time | Instant (repoint HTML to old hash) | 30s – 180s (requires fresh purge) | Immediate zero-risk rollbacks |
Three hidden costs of fixed filenames
Purging fixed filenames after every build feels simple, but it creates three operational failure modes in production:
- Cache stampedes on deploy: When an invalidation clears
bundle.jsacross 300+ edge nodes, the next incoming wave of visitor traffic misses the cache at once, hammering your origin bucket with duplicate requests. - Split-brain asset mismatches: Edge nodes do not invalidate in lockstep. A POP in New York might purge within 28 seconds while a POP in Sydney takes 140 seconds. Visitors loading a new
index.htmlfrom Frankfurt that requests a new exported function from an unpurgedbundle.jsin Sydney suffer broken page states. - Surging invalidation bills: Major CDNs charge for path invalidations once you exceed free monthly allowances. Automated CI/CD pipelines deploying multiple branches daily quickly incur hundreds of dollars in purge fees.
The content-hashed deployment workflow
Modern build tools like Vite, Next.js, and esbuild automatically append SHA-256 or MD5 chunks to compiled asset filenames. Because <code>bundle.8d3f1a.js</code> will never change its contents, browsers and CDN edge caches can hold it indefinitely without revalidating.
To upload your build to an S3-compatible bucket, use a two-step upload script that sets distinct <code>Cache-Control</code> headers for hashed assets versus HTML entry points:
When you push a new build, <code>index.html</code> points to <code>bundle.c49e2b.js</code>. The browser checks <code>index.html</code>, gets the new HTML with a 304 or 200, and downloads only the newly changed bundles. Old bundles remain untouched in the bucket so existing visitors finishing active sessions never encounter 404 errors.
Worked math: the monthly cost of CDN invalidations
AWS CloudFront charges $0.005 per invalidated path after the first 1,000 free paths each month. Here is what that costs across three typical engineering team release cadences:
| Team profile | Deploys / day | Assets purged per deploy | Monthly invalidation paths | Monthly purge bill (CloudFront) | Monthly purge bill (Content hashes) |
|---|---|---|---|---|---|
| Solo developer / side project | 3 | 8 assets | 720 paths | $0.00 (within 1,000 free paths) | $0.00 |
| Active SaaS product team | 15 | 40 assets | 18,000 paths | $85.00 / mo | $0.00 |
| Continuous delivery CI/CD | 50 | 150 assets | 225,000 paths | $1,120.00 / mo | $0.00 |
| Multi-repo micro-frontends | 120 | 300 assets | 1,080,000 paths | $5,395.00 / mo | $0.00 |
With content-hashed filenames, your invalidation bill is always $0.00 because you never call a purge API. New versions are published by writing a single 3 KB <code>index.html</code> object to the bucket.
Testing cache headers with curl
Verify your deployed headers from the terminal. The hashed asset should return <code>max-age=31536000, immutable</code> and hit edge cache on repeat requests:
Origin storage and egress protection
Combining content-hashed asset versioning with <b>tport.space</b> gives your frontends complete resilience against unexpected traffic spikes. With S3-compatible storage, public bucket hosting, and zero egress fees, you can store historical releases side-by-side without paying penalty fees when thousands of clients fetch cold asset chunks.
Explore our related guides on object storage caching and static website delivery:
- Review measured browser request savings in our benchmark on Cache-Control on S3 images (
/articles/cache-control-s3-images-requests-bytes). - Learn when to use open public buckets versus restricted signed links in Presigned URLs or public files: how to share a bucket object without leaking a key (
/articles/presigned-urls-public-files-share-bucket-object). - Configure SPA fallback routes and error documents with our guide on Hosting a static site from a bucket: index pages, 404s and cache headers tested (
/articles/hosting-static-site-bucket-index-404-cache).
Host static web assets and public files on S3-compatible storage with zero egress fees.
Deploy on tport.space