Cloudflare Docs
Cache
Edit this page on GitHub
Set theme to dark (⇧+D)

Default Cache Behavior

Cloudflare respects the origin web server’s cache headers in the following order unless an Edge Cache TTL cache rule overrides the headers.

  • Cloudflare does not cache the resource when:
    • The Cache-Control header is set to private, no-store, no-cache, or max-age=0.
    • The Set-Cookie header exists.
  • Cloudflare does cache the resource when:
    • The Cache-Control header is set to public and max-age is greater than 0.
    • The Expires header is set to a future date.

For a list of directives and behaviors when Origin Cache-Control is enabled or disabled, refer to Cache-Control directives.

​​ Default cached file extensions

Cloudflare only caches based on file extension and not by MIME type. The Cloudflare CDN does not cache HTML by default. Additionally, Cloudflare caches a website’s robots.txt.

7ZCSVGIFMIDIPNGTIFZIP
AVIDOCGZMKVPPTTIFFZST
AVIFDOCXICOMP3PPTXTTF
APKDMGISOMP4PSWEBM
BINEJSJAROGGRARWEBP
BMPEOTJPGOTFSVGWOFF
BZ2EPSJPEGPDFSVGZWOFF2
CLASSEXEJSPICTSWFXLS
CSSFLACMIDPLSTARXLSX

To cache additional content, refer to Cache Rules to create a rule to cache everything.

​​ Customization options and limits

Cloudflare’s CDN provides several cache customization options:

  • Caching behavior for individual URLs via Cache Rules
  • Customize caching with Cloudflare Workers
  • Adjust caching level, cache TTL, and more via the Cloudflare Caching app

​​ Upload limits

FreeProBusinessEnterprise

Availability

YesYesYesYes

Max upload size

100 MB100 MB200 MB500+ MB

If you require a larger upload, group requests smaller than the upload thresholds or upload the full resource through an unproxied (grey-clouded) DNS record.

​​ Cacheable size limits

Cloudflare cacheable file limits:

  • Free, Pro and Business customers have a limit of 512 MB.
  • For Enterprise customers the default maximum cacheable file size is 5 GB. Contact your account team to request a limit increase.

​​ Cloudflare cache responses

The output of the CF-Cache-Status header shows whether or not a resource is cached. To investigate cache responses returned by the CF-Cache-Status header, use services like Redbot, webpagetest.org, or a visual tool like Chrome’s Dr. Flare plugin.

StatusDescription
HITThe resource was found in Cloudflare’s cache.
MISSThe resource was not found in Cloudflare’s cache and was served from the origin web server.
NONE/UNKNOWNCloudflare generated a response that denotes the asset is not eligible for caching. This may have happened because:
  • A Worker generated a response without sending any subrequests. In this case, the response did not come from cache, so the cache status will be none/unknown.
  • A Worker request made a subrequest (fetch). In this case, the subrequest will be logged with a cache status, while the main request will be logged with none/unknown status (the main request did not hit cache, since Workers sits in front of cache).
  • A WAF custom rule was triggered to block a request. The response will come from the Cloudflare global network before it hits cache. Since there is no cache status, Cloudflare will log as none/unknown.
  • A redirect cache rule caused the global network to respond with a redirect to another asset/URL. This redirect response happens before the request reaches cache, so the cache status is none/unknown.
  • EXPIREDThe resource was found in Cloudflare’s cache but was expired and served from the origin web server.
    STALEThe resource was served from Cloudflare’s cache but was expired. Cloudflare could not contact the origin to retrieve an updated resource.
    BYPASSThe origin server instructed Cloudflare to bypass cache via a Cache-Control header set to no-cache,private, or max-age=0 even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling Origin Cache-Control. Cloudflare also sets BYPASS when your origin web server sends cookies in the response header. If the Request to your origin includes an Authorization header, in some cases the response will also be BYPASS. Refer to Conditions in the Origin Cache-Control behavior section for more details.
    REVALIDATEDThe resource is served from Cloudflare’s cache but is stale. The resource was revalidated by either an If-Modified-Since header or an If-None-Match header.
    UPDATINGThe resource was served from Cloudflare’s cache and was expired, but the origin web server is updating the resource. UPDATING is typically only seen for very popular cached resources.
    DYNAMICCloudflare does not consider the asset eligible to cache and your Cloudflare settings do not explicitly instruct Cloudflare to cache the asset. Instead, the asset was requested from the origin web server. Use Cache Rules to implement custom caching options.