Subscribe to receive notifications of new posts:

Edge Cache Expire TTL: Easiest way to override any existing headers

2013-02-01

2 min read
Edge Cache Expire TTL: Easiest way to override any existing
headers

CloudFlare makes caching easy. Our service automatically determines what files to cache based on file extensions. Performance benefits kick in automatically.

For customers that want advanced caching, beyond the defaults, we have Cache Everything available as Page Rules. Designate a URL and CloudFlare will cache everything, including HTML, out at the edges of our global network.

With Cache Everything, we respect all headers. If there is any header in place from the server or a CMS solution like WordPress, we will respect it. However, we got many requests from customers who wanted an easy way to override any existing headers. Today, we are releasing a new feature called 'Edge cache expire TTL' that does just that.

What is Edge Cache Expire TTL?

Edge cache expire TTL is the setting that controls how long CloudFlare's edge servers will cache a resource before requesting a fresh copy from your server. When you create a Cache Everything Page Rule, you now may choose whether to respect all existing headers or to override any headers that are in place from your server. By overwriting the headers, CloudFlare will cache more content at the CloudFlare edge network, decreasing load to your server.

Common situations where you may choose to overwrite existing headers:

  • You expect a large surge in traffic

  • You are under DDOS attack

  • You are not sure what the headers on WordPress or your server are set to

  • You are using WordPress and want to easily overwrite the default settings

It is important to emphasize when you do not want to use Cache Everything. If you have any personalized information on the page like login information or credit card information, you do not want to use the Cache Everything option.**What is Browser Cache Expire TTL?**Browser cache expire TTL is the time that CloudFlare instructs a visitor's browser to cache a resource. Until this time expires, the browser will load the resource from its local cache thus speeding up the request significantly. CloudFlare will respect the headers that you give us from your web server, and then we will communicate with the browser based on the time selected in this drop down menu.

Using both Edge Cache Expire TTL and Browser Cache Expire TTL

When you'd like to have CloudFlare cache your content but want your visitors to always get a fresh copy of the page, you can use the new 'Edge cache expire TTL' setting to express this differentiation. Set a value for 'Edge cache expire TTL' to how often you want the CloudFlare CDN to refresh from your server, and 'Browser cache expire TTL' to how often you want your visitors' browsers to refresh the page content. This is useful when you have a rapidly changing page but still want the benefit of the CloudFlare cache to reduce your server load.

Plan Details

CloudFlare offers a range of edge cache expire TTLs based on plan type:

  • Free 2 hours

  • Pro 1 hour

  • Business 30 minutes

  • Enterprise as low as 30 seconds

A Pro customer may set the refetch time to 1 hour. After 60 minutes, we return to your server for a fresh copy of the resource. Business customers may lower the refetch interval to 30 minutes. Enterprise customers may set this interval as low as 30 seconds.

How to Turn It On

Login in to your CloudFlare account and choose "Page Rules" from under the gear icon. Enter the URL that you want to Cache Everything (under Custom Caching):

Edge Cache Expire TTL: Easiest way to override any existing headers

The edge cache server TTL option will appear:

Edge Cache Expire TTL: Easiest way to override any existing headers

The default setting is set to "Respect all existing headers." To override this setting, choose a time from the drop down menu:

Edge Cache Expire
TTL: Easiest way to override any existing
headers

You can find more information in our knowledge base articles here and here.

Give it a try and let us know what you think.

Cloudflare's connectivity cloud protects entire corporate networks, helps customers build Internet-scale applications efficiently, accelerates any website or Internet application, wards off DDoS attacks, keeps hackers at bay, and can help you on your journey to Zero Trust.

Visit 1.1.1.1 from any device to get started with our free app that makes your Internet faster and safer.

To learn more about our mission to help build a better Internet, start here. If you're looking for a new career direction, check out our open positions.
CacheTTLSpeed & Reliability

Follow on X

Michelle Zatlyn|@zatlyn
Cloudflare|@cloudflare

Related posts

September 25, 2024 1:00 PM

Introducing Speed Brain: helping web pages load 45% faster

We are excited to announce the latest leap forward in speed – Speed Brain. Speed Brain uses the Speculation Rules API to prefetch content for the user's likely next navigations. The goal is to download a web page to the browser before a user navigates to it, allowing pages to load instantly. ...