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 TTLWhen 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 DetailsCloudFlare 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 OnLogin 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):The edge cache server TTL option will appear:The default setting is set to "Respect all existing headers." To override this setting, choose a time from the drop down menu:
Give it a try and let us know what you think.