Set the cache duration (TTL) for browsers

On this page

Files are cached on your Sirv CDN and in your users' browsers, for the fastest possible loading speed.

This article explains the default cache settings and how to change them.

CDN file cache purging

Sirv CDN automatically stays up to date. You don't need to manually purge the CDN after you upload new versions of files to Sirv. All cached versions of the old file are invalidated within 3 seconds across Sirv's CDN, meaning the old file will never be served again. However, it might still exist in a users browser cache, so consider adjusting the default browser cache duration.

Browser cache duration

Browsers cache (save) files so help them load fast, rather than re-downloaded the same files again from the CDN.

Sirv sets an "expires header" of 7 days by default, meaning that file will live in the browser cache for the next 7 days. Known as the TTL (time to live), 7 days is a broadly suitable period for files that change relatively frequently. If your files change rarely, consider increasing the TTL as long as 1 year. If they change frequently, consider reducing it to 1 day or even less.

It's easy to set your browser cache duration to one of the following expiries:

  • 1 hour
  • 3 hours
  • 12 hours
  • 1 day
  • 7 days
  • 30 days
  • 1 year

Change global cache duration

This global setting applies to all files in your Sirv account, specified in your Default profile. (It can be overridden with a profile, see below).

To change the default duration:

1. Go to your Default profile. Browsers cache images for the duration specified in thewhich is served with each file.

2. Click 'Delivery settings' in the top left.

3. Change the value then click Save:

CDN file purge button

Change cache duration per-profile

To set a different cache expiry time for specific files, apply a profile to those files. Each profile can have its own cache expiry time.

A profile can be applied by appending its name in the URL, for example:

In the above example, the profile is named "long-expiry".

TTL for scripts and video streams

Files delivered from and have a TTL of 7 days.

Was this article helpful?

Get help from a Sirv expert