Maximize Bandwidth Savings With Page Rules

By default Cloudflare caches the most popular types of static assets and serves them from a Cloudflare edge server closest to your visitor’s geographic location reducing your operating costs.

Learn how Page Rules allow you to utilize advanced caching options that can significantly reduce the bandwidth your server uses to further lower your operating costs.

To purchase Page Rules, visit the Cloudflare dashboard.

Overview

In the above video you will learn how to:

  • Reduce HTTP requests with HTTP/2
  • Extend Cloudflare caching capabilities
  • Enable on-the-fly JavaScript bundling and asynchronous loading

Video Transcript

By default, Cloudflare caches the most popular types of static assets and serves them from a Cloudflare edge server closest to your visitor’s geographic location. While this alone can significantly reduce how much bandwidth your server uses, more advanced caching options can be leveraged by using Page Rules to further reduce your operating costs.

Cache Level

Cache Level provides you the ability to extend what types of assets Cloudflare will cache as well as how to handle requests for cached resources. The Cache Everything setting provides the most aggressive caching mode available. This option targets all available resources beyond Cloudflare’s default types, including HTML, JSON data, and movie files and stores them on Cloudflare’s edge servers.

I’ve applied the Cache Everything option to a number of different areas of my domain. When using an asterisk in my URL pattern, I allow this specific Page Rule to take affect on not only this directory, but also any subdirectories and query strings which may be appended to the URL. In other Page Rules I am much more specific, and excluding the asterisk means that I am targeting ONLY this specific page. Subdirectories and appended query strings will honor Cloudflare's default caching behavior.

Edge Cache TTL

Edge Cache TTL will have a significant effect on your origin bandwidth usage as it instructs Cloudflare on how often to request new content from your server. In areas of my domain where my content or assets will rarely change, I’ve set a very long Edge Cache TTL of a month. This means Cloudflare will only request a fresh copy of the assets from my server after an entire month as passed.

If a resource were to change in this area and I wanted to force a refresh before the set TTL time, the Purge Cache feature in the Caching section of the dashboard gives you the ability to force the refresh of a specific file or directory.

Browser Cache TTL

Browser Cache TTL instructs the user’s browser how often it should attempt to request new content from Cloudflare’s edge. While this setting will have minimal impact on your origin bandwidth utilization, Browser Cache TTL can be used in conjunction with aggressive cache settings to make sure your visitors are getting the content you intended on delivering.

A good default setting is 4 hours. For pages where the content simply doesn’t change very frequently, I set the default for as long as an entire day.

Conclusion

In this video you learned how Page Rules allows you to leverage advanced caching features like Cache Level, Edge Cache TTL and Browser Cache TTL on specific URLs to significantly reduce your bandwidth usage and reduce your operating costs.

The number of Page Rules available to your domain is limited by plan type. If you need more Page Rules, Cloudflare now offers you the ability to purchase more Page Rules a la carte. Be sure to visitor our plans page for more information at: www.cloudflare.com/plans