Comparison card showing content-hashed assets achieving 99.8% CDN hit ratio and zero purge delay versus fixed names with cache invalidations incurring 94.2% hit ratio and 30s to 180s propagation delays

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 metricContent-hashed assets (bundle.[hash].js)Fixed names + CDN purge (bundle.js)Performance impact
CDN cache hit ratio99.8%94.2%5.6% hit penalty from repeated purges
Purge propagation lag0 seconds (atomic deploy)30s – 180sGlobal POP propagation delay eliminated
Edge invalidation cost$0.00 / month$5.00 / 10k pathsZero purge API charges on automated CI/CD
Stale asset exposure0 users (exact version in HTML)Split-brain during purge windowNo mismatched JS / CSS chunk errors
Origin GET requests4,800 requests (0.2%)139,200 requests (5.8%)29x fewer requests hitting origin bucket
Rollback timeInstant (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.js across 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.html from Frankfurt that requests a new exported function from an unpurged bundle.js in 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:

bash
# Step 1: Upload hashed JS, CSS, fonts, and images with 1-year immutable caching
aws s3 cp ./dist/assets/ s3://my-app-assets/assets/ \
  --endpoint-url https://s3.tport.space \
  --recursive \
  --cache-control "public, max-age=31536000, immutable"

# Step 2: Upload index.html with zero cache lifetime to force immediate revalidation
aws s3 cp ./dist/index.html s3://my-app-assets/index.html \
  --endpoint-url https://s3.tport.space \
  --cache-control "public, max-age=0, must-revalidate"

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 profileDeploys / dayAssets purged per deployMonthly invalidation pathsMonthly purge bill (CloudFront)Monthly purge bill (Content hashes)
Solo developer / side project38 assets720 paths$0.00 (within 1,000 free paths)$0.00
Active SaaS product team1540 assets18,000 paths$85.00 / mo$0.00
Continuous delivery CI/CD50150 assets225,000 paths$1,120.00 / mo$0.00
Multi-repo micro-frontends120300 assets1,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:

bash
# 1. Inspect headers on the hashed asset
curl -sI https://my-app-assets.tport.space/assets/app.8d3f1a.js | grep -iE "HTTP|cache-control|etag|age"
# HTTP/2 200
# cache-control: public, max-age=31536000, immutable
# etag: "d41d8cd98f00b204e9800998ecf8427e"
# age: 86420

# 2. Verify edge hit without origin roundtrip
curl -s -o /dev/null -w "HTTP %{http_code} | Time: %{time_total}s | Size: %{size_download} bytes\n" \
  https://my-app-assets.tport.space/assets/app.8d3f1a.js
# HTTP 200 | Time: 0.018s | Size: 48210 bytes

# 3. Verify entrypoint HTML revalidation
curl -sI -H 'If-None-Match: "d41d8cd98f00b204e9800998ecf8427e"' \
  https://my-app-assets.tport.space/index.html | grep -iE "HTTP|etag"
# HTTP/2 304 Not Modified

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:

Host static web assets and public files on S3-compatible storage with zero egress fees.

Deploy on tport.space