Need Page rule advice

I have an application with the following URL structures:

  2., etc.

These are the application home pages for different regions.
I want specific cache rules for*.
But I don’t want to Cache anything under*/.
The page redirects to which is handled at the application level.

Hi there,

You would need to have the most specific URL on top. In this case:


I am not sure if the en-ca bit would need a Page Rule here, but if it does that would be the order. Keep in mind that only one Page Rule will be matched per request.

I hope this helps. :slight_smile:


I’am afrait with CloudFlare PageRules we just have the option to use asterix (*) as a wildcard which acts like a kleene star at RegEx. Therefore you do not have any control over how many “wildcard chars” are beeing matched unlike at RegEx for example:


Matches unlimited random chars


Matches unlimited random chars

Matches 2 random chars.
(actually that what you want)

This apparently is not possible with CloudFlare.

You will have to create a single PageRule for every URL to match it exactly, as you can not match the wanted URLs directly without anything else NOR the exact oposit to exclude the exact oposit of what you want from a rule.

I personally would love it if CloudFlare would provide a bit more flexibility when it comes to operators. Something very easy like:|bz|ca|cb|gb|ie|jm|nz|ph|tt|us|za|zw)/
which matches with an OR operator explizitly ALL your possible sub-languagecodes for englisch language.

or something like this:{2})/

which means just 2 random chars.
But chances are low this ever will be implemented.
A little workaround is. Set differenciate the language based on the FQDN and take a different Subdomain for each different language.



These would be matchable with:

Pattern: en-*
Rule: Cache Everything

This would not match way more as the function of the wildcard is limited to the range of the subdomain - if you understand what I mean. This rule then would just match the rootPage for all languageRootDirectories (startage of all languages then in Cached)

The more often I read your question the more I think I missunderstood your requirement. If that is the case just explain it again.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.