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

Create a cache rule in the dashboard

  1. Log in to the Cloudflare dashboard and select your account and domain.
  2. Go to Caching > Cache Rules.
  3. Select Create rule.
  4. Enter a descriptive name for the rule in Rule name.

Enter the rule name
  1. Under When incoming requests match, define the rule expression. Use the Field drop-down list to choose an HTTP property and select an Operator. Refer to Available settings for the list of available fields and operators.

Select fields in the Expression Builder.
  1. Following the selection of the field and operator, enter the corresponding value that will trigger the Cache Rule. For example, if the selected field is Hostname and the operator is equals, a value of cloudflare.com would mean the rule matches any request to that hostname.

Example rule
  1. Under Then, in the Cache status section, select Bypass cache if you want matching requests to not be cacheable, or Eligible for cache if you want Cloudflare to attempt to cache them. Note that cache-control headers can also impact cache eligibility.

Select eligible for cache
  1. If you selected Eligible for cache in the previous step, you can customize the options described in the Available settings section.

  2. To save and deploy your rule, select Deploy. If you are not ready to deploy your rule, select Save as Draft.