Cloudflare rules do not respect uppercase or lowercase directories

Hello everyone, excuse my spelling I do not speak English, this I do with the Google translator.
I own the Cloudflare Pro plan for my domain
I have a problem with the Cloudflare rules, since I try to cache the html of the static content but the rule affects my dynamic content as well.

Cloudflare does not make a difference in the lowercase or uppercase url
example: my website has several languages, but I put them as a single French language (fr) I have two directories one with a capital letter that is where I have the wordpress facilities and the other for the static content. (static content) (dynamic content)

I have a rule for static content
Cache Level (Cache Everything)

But I do not understand why this rule is affecting me too /Fr/, I’m just giving it to /fr/

I am curious. If you make a Page Rule for /Fr/, does it affect /fr/ also? Will it even work on /Fr/?

I see other posts about Page Rules and they all have trouble with upper case.

Yes, this affects. If I set a rule for /Fr/ it also affects /fr/, this is a headache for me since I have two different directories, and I need different rules for each directory.

1 Like

I don’t think Cloudflare will change this behavior, but you can certainly open a Support Ticket.

Is it just the last two entries (en and fr) that are the problem? The only thing I could suggest is if those two directories have subdirectories that are unique to them, make Page Rules for those. Or at least the ones used the most. Or…if the static content ends with .html, how about matching /fr/*.html ?

I seem to be able to confirm that Cloudflare is case insensitive in this regard.

@bibliatodo, the best advice might be to change your directory structure to not have two such similarly named directories. If that is not possible the only solution really might be the more specific match @sdayman suggested.

1 Like

The problem is that I can not change the structure of the directories. because it would waste years of positioning in search engines and a lot of 404 errors that I can not solve with 301 redirect. The website has approximately 150,000 visits per day.
I have a problem with the / Fr / directory, it also affects the other languages in the directories; / In / with / in /, / Pt / with / pt /, I would like to take the recommendation that @sdayman suggested, but unfortunately my static pages do not end in .html nor with any extension.
This makes me cry :weary:

Whats the difference between Fr and fr?

Lower case is static, and they want that Cache Everything’d.
Upper case is dynamic, and they don’t want it Cached Everything’d. But the rule doesn’t differentiate, so dynamic Fr gets cached along with the static fr.

Cloudflare page rules are not case sensitive. Rather than focusing on the inability to have a different rule for /fr/ vs /FR/ what is the actual issue/problem you are trying to solve?

Do you have static content which isn’t covered in the content types which Cloudflare already caches by default? If so, what content types are those?

I believe they want to cache html, but it’s not .html files. Possibly PHP generated, but they never change.

In that case simply change your lower cased static directories. These you wont use for search engines and if their paths change it shouldnt be a problem.

the static content of / fr / is generated by php with a codeigniter installation, this content never changes, we have url with thousands of daily visits, we can not change that route, and the dynamic content of / Fr / is generated by an installation from wordpress. We can NOT change the structure of the directories.
That’s why I need to set different rules for each directory

This is why I wanted the actual problem trying to be solved… Set cache control headers on your origin in each directory. If you don’t want the dynamic content from Wordpress cached send a no-cache header. Set whatever TTL you want for the static content, send a header with it for content in that directory. Remove the edge cache TTL from your page rule(s).


What would be the header that I should place for my dynamic pages? What should I place?
because I have placed is
< meta http-equiv = Cache-Control content = “max-age = 3600” >
but that works for me only for the browser cache.
Is there a header rule so that Cloudflare does not have an html cache?
I will be very grateful for your help

Headers are sent through PHP code or in the “.htaccess” file found in each directory! I don’t know the header contents in your case though, a more knowledgeable person should help you with that…

This topic was automatically closed after 14 days. New replies are no longer allowed.