Migration from Page Rules
If you are migrating from Page Rules, there is a behavior change between Page Rules and Cache Rules.
When you create a new Cache Rule and select Eligible for cache, the Cache Everything feature is enabled by default. With Page Rules, you had to specifically enable the Cache Everything option.
To maintain the same behavior you had with Page Rules (that is, not enabling Cache Everything), you need to create these two specific rules in this order before creating any additional rules.
Multiple matching cache rules can be combined and applied to the same request. After rule 1 matches, Cloudflare will keep evaluating other cache rules checking for matches. For more information, refer to Order and priority.
- Enter a rule name, for instance
bypass everything
. - In When incoming requests match, select All incoming requests.
- Under Then, in the Cache eligibility section, select Bypass cache.
- Enter a rule name, for instance
cache all default cacheable extensions
. - In When incoming requests match, select Custom filter expression.
- Define the following rule:
- Field:
File extension
- Operator:
is in
- Value:
7z, avi, avif, apk, bin, bmp, bz2, class, css, csv, doc, docx, dmg, ejs, eot, eps, exe, flac, gif, gz, ico, iso, jar, jpg, jpeg, js, mid, midi, mkv, mp3, mp4, ogg, otf, pdf, pict, pls, png, ppt, pptx, ps, rar, svg, svgz, swf, tar, tif, tiff, ttf, webm, webp, woff, woff2, xls, xlsx, zip, zst
- Field:
If you prefer, you can select Edit expression and paste the following expression:
- Under Then, in the Cache eligibility section, select Eligible for cache.