Understanding Browser Cache Expiration

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 Expiration 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 headers with values set via the Browser Cache Expiration 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 Expiration 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 Expiration to Respect Existing Headers.

Setting browser cache expiration

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

If you modify cached assets, the new asset isn’t displayed to a repeat visitor before the Browser Cache Expiration 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 Expiration, 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.

Powered by Zendesk