Understanding browser cache expire TTL

Overview

When creating a Page Rules, the Browser Cache Expire TTL parameter is the time that Cloudflare instructs a visitor's browser to cache a resource by setting the Cache-Control header's max-age. Until this time expires, the browser will load the resource from its local cache thus speeding up the request significantly. 

Cloudflare 
will add a Cache-Control header to the resources matched by the Page Rule if there is no Cache-Control header added to the resource by the origin server or Cloudflare will replace the Cache-Control header added by the origin server only if the Browser Cache TTL is longer than the TTL in the Cache-Control header set by the origin.

It is possible to instruct Cloudflare not to replace Cache-Control using a feature called Respect Existing Headers. 


Enable Respect Existing Headers

To enable this feature,

1. Log into your Cloudflare account.

2. Click the Caching app.

3. Scroll down to Browser Cache Expiration, and select the Respect Existing Headers value. After this is set, Cloudflare will not override Cache-Control headers (even if they don't exist at all).

browser_cache_expiration_respect_existing_headers.png

All users can change this setting site-wide using the Browser Cache Expiration option in the Caching tab, however, Enterprise customers are able to set Respect Existing Headers via a Page Rule in the Browser Cache TTL setting.


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