Understanding Browser Cache TTL

Learn about setting expiration for resources cached in a visitor’s browser.


Overview

Cloudflare caches specific static assets to provide your visitors a fast experience. You can specify a time for a visitor’s Browser Cache TTL in the Cloudflare Caching app. Alternatively, refer to Cloudflare’s documentation on Edge Cache TTL for configuring cache duration within Cloudflare’s data centers.

By default, Cloudflare honors the cache expiration set in your Expires and Cache-Control headers. Cloudflare overrides any Cache-Control or Expires headers with values set via the Browser Cache TTL option in the Cloudflare Caching app if:

  • The value of the Cache-Control header from the origin web server is less than the Browser Cache TTL Cloudflare setting, or
  • the origin web server does not send a Cache-Control header.
Unless specifically set in a Page Rule, Cloudflare does not override or insert Cache-Control headers if you set Browser Cache TTL to Respect Existing Headers.

Setting Browser Cache TTL

Set the Browser Cache TTL option in the Cloudflare Caching app. To accelerate page load for your repeat visitors, select a high Browser Cache TTL.

If you modify cached assets, the new asset isn’t displayed to a repeat visitor before the Browser Cache TTL duration. Purging Cloudflare’s cache does not affect assets cached in a visitor’s browser.
  1. Login to Cloudflare and select the appropriate site.
  2. Select the Caching app.
  3. Scroll to Browser Cache TTL, and click the drop-down menu to select the desired cache expiration.

The Respect Existing Headers option tells Cloudflare to honor the settings in the Cache-Control headers from your origin web server.


Related resources

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.