> linacre.site

Optimizing Vercel Edge CDN Caching Headers

By David Linacre · 2026-07-08 · 5 min read · Vercel, CDN, Caching, DevOps

Caching is the most cost-effective performance optimization available. By tuning cache-control parameters on your Vercel deployment, you can deliver sub-100ms load times globally.

1. Immutable Assets

Because Vite hashes output files (e.g., index-CUFdy6z6.js), we know these files will never change. We can safely cache them forever at the browser and edge level:

{
  "source": "/assets/(.*)",
  "headers": [
    { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
  ]
}

2. Handling HTML Fallbacks

HTML routes must never use immutable cache settings, otherwise visitors will receive updates. However, we can cache them at the Edge using s-maxage and force revalidation:

{
  "source": "/index.html",
  "headers": [
    { "key": "Cache-Control", "value": "public, max-age=0, s-maxage=31536000, must-revalidate" }
  ]
}

Conclusion

With these headers configured, static files serve directly from Vercel's edge cache nodes close to the user, bypassing server routing latency entirely.

← All engineering notes