Vercel not caching assets (image, video, audio)

Viewed 522

I have a page with tons of static assets (image, video, audio) which affects really bad the page performance.

When checking the network tab, I find out that all those assets are not cached (the cache control is public, max-age=0, must-revalidate) despite the fact that I use Vercel for deployment.

Am I missing something or are there any other ways to optimize more?

1 Answers

Vercel caches your content at the edge using their Edge Network.

From Vercel's Caching documentation:

The Vercel Edge Network caches your content at the edge in order to serve data to your users as fast as possible.

Static caching is automatic for all deployments. This means that no changes need to be made to headers.

However, you can still customise it by overriding the Cache-Control header.

By default we return a Cache-Control header containing public, max-age=0, must-revalidate to prevent clients (e.g. browsers) from caching the file locally. This gives you the most flexibility as users get the latest file from our Global CDN immediately after deploying. This can be overridden with the Headers property in your vercel.json file.

Related