Based on this post:
And also, from my understanding of the documentation, is the order of these Page Rules correct? (all the same domain)
Lastly, is there any way to cut down on the # of rules? by doing this smarter?
Thanks.
Based on this post:
And also, from my understanding of the documentation, is the order of these Page Rules correct? (all the same domain)
Lastly, is there any way to cut down on the # of rules? by doing this smarter?
Thanks.
The important thing to remember with Page Rules is only one is executed per URL.
Those Page rules look fine. Is there any issue you are having with them?
If you want to save on Page Rules, use the new Rules instead of Page rules.
These can be a bit more difficult to understand at first, and do not support wildcards (but do support contains functions and such), but you get more of them, and if you are smart enough, you can roll some of these up into a single rule.
For example, your first rule could be converted to a cache rule like this:
Read the docs on the fields at Fields reference · Cloudflare Ruleset Engine docs and you can do a lot of powerful operations.
As another example, combine two into one using is in
(potentially you could include the last page rule in here as well, didn’t see it until after, depends how you want to handle ordering though):
Combine 1 and 6 into the same using Or
It’s important to note though that Cache Rules have their own sorting logic that differs from Page Rules:
- If you have conflicting settings, then ordering matters and rules will be applied in the order they appear in your Cloudflare dashboard, from bottom to top. For example, if the top rule is set to cache everything on
example.com/images
and the bottom rule is set to bypass cache onexample.com
, then because we apply rules from bottom to top, cache will be bypassed for all URLs that matchexample.com
. To create this type of wildcard rule that applies to everything in the URI directory, when creating a cache rule in the dashboard, select the option URI in Field, starts with in Operator, andexample.com
in Value.
ps. For changing security level, you’ll want Configuration Rules. The rest you can do in Cache Rules
I will have a look into this when I have some time!! thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.