Cloudflare respects the origin web server’s cache headers in the following order unless an Edge Cache TTL cache rule overrides the headers. Refer to the Edge TTL section for details on default TTL behavior.
- Cloudflare does not cache the resource when:
- The
Cache-Controlheader is set toprivate,no-store,no-cache, ormax-age=0. - The Set-Cookie header exists.
- The HTTP request method is anything other than a
GET.
- The
- Cloudflare does cache the resource when:
- The
Cache-Controlheader is set topublicandmax-ageis greater than 0. - The
Expiresheader is set to a future date.
- The
When Origin Cache Control is enabled on an Enterprise customer’s website, it indicates that Cloudflare should strictly respect Cache-Control directives received from the origin server. Free, Pro and Business customers have this feature enabled by default. For a list of directives and behaviors when Origin Cache-Control is enabled or disabled, refer to Cache-Control directives.
Clients can use the HTTP Range header to request part of a file. Cloudflare can serve these requests from complete or partial cached files. Response behavior depends on the request method, range syntax, conditional headers, content encoding, and cache eligibility.
For complete response and origin requirements, refer to Range request behavior.
When multiple requests arrive simultaneously at a single Cloudflare data center for the same asset that is not in cache (a cache miss), Cloudflare uses a cache lock to avoid sending duplicate requests to your origin. Only the first request is forwarded to the origin to fetch the asset. The remaining requests wait for the first request to complete, after which the response is streamed ↗ to all waiting requests.
The cache lock ensures that Cloudflare only sends one request at a time to the origin for a given asset from a single location in Cloudflare's network, preventing the origin from receiving excessive traffic.
Cloudflare only caches based on file extension and not by MIME type. The Cloudflare CDN does not cache HTML or JSON by default. Additionally, by default Cloudflare caches a website's robots.txt.
| 7Z | CSV | GIF | MIDI | PNG | TIF | ZIP |
| AVI | DOC | GZ | MKV | PPT | TIFF | ZST |
| AVIF | DOCX | ICO | MP3 | PPTX | TTF | |
| APK | DMG | ISO | MP4 | PS | WEBM | |
| BIN | EJS | JAR | OGG | RAR | WEBP | |
| BMP | EOT | JPG | OTF | SVG | WOFF | |
| BZ2 | EPS | JPEG | SVGZ | WOFF2 | ||
| CLASS | EXE | JS | PICT | SWF | XLS | |
| CSS | FLAC | MID | PLS | TAR | XLSX |
To cache additional content, refer to Cache Rules