Get started with Cache
Cloudflare makes customer websites faster by storing a copy of the website’s content on the servers of our globally distributed data centers. Content can be either static or dynamic: static content is “cacheable” or eligible for caching, and dynamic content is “uncacheable” or ineligible for caching. The cached copies of content are stored physically closer to users, optimized to be fast, and do not require recomputing.
Cloudflare caches static content based on the following factors:
- Caching levels
- File extension
- Presence of query strings
- Origin cache-control headers
- Origin headers that indicate dynamic content
- Cache rules that bypass cache on cookie
Cloudflare only caches resources within the Cloudflare data center that serve the request. Cloudflare does not cache off-site or third-party resources, such as Facebook or Flickr, or content hosted on unproxied (grey-clouded) DNS records.
Learn the basics
Discover the benefits of caching with Cloudflare’s CDN and understand the default cache behavior.
- Understand what is a CDN
- Understand default cache behavior
- Understand the default file types Cloudflare caches
Make more resources cacheable
Configure your settings to cache static HTML or cache anonymous page views of dynamic content.
- Customize Caching with Cache Rules
- Specify which resources to cache
- Understand Origin Cache Control
- Cache by device type (Enterprise only)
Improve cache hit rates
Include or exclude query strings, optimize cache keys, or enable tiered cache to improve hit rates and reduce traffic to your origin.
- Choose a cache level
- Enable Tiered Cache with Argo
- Configure custom cache keys (Enterprise only)
- Enable Prefetch URLs (Enterprise only)
Secure your cache configuration
Control resources a client is allowed to load and set access permissions to allow different origins to access your origin’s resources. Protect your site from web cache deception attacks while still caching static assets.
- Avoid web cache poisoning attacks
- Configure Cross-Origin Resource Sharing (CORS)
- Enable Cache Deception Armor
Cloudflare features that can alter your HTML and cacheable objects
To provide Cloudflare services to our customers, we may need to alter your HTML or cached objects to enable the feature or provide optimization.
These code alterations only occur on the cacheable objects found at Cloudflare’s edge and do not affect the original source. The changes will also be removed if the specific feature is disabled and the cache is purged.
Review the list of Cloudflare features that function in this manner:
- Auto Minify (deprecated)
- Rocket Loader
- Polish
- Mirage
- Hotlink Protection
- Email address obfuscation
- Bot Management JavaScript Detections
Troubleshoot
Resolve common caching concerns.