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:
WildCard:
‘*
’
Matches unlimited random chars
RegEx:
‘.?
’
Matches unlimited random chars
‘.{2}
’
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:
example.com/en-(au|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:
example.com/en-(.{2})/
OR
example.com/en-*{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.
Like:
en-us.example.com
en-ca.example.com
These would be matchable with:
Pattern: en-*.example.com
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.