Help understanding new caching rules

I am trying to switch over from the old Page Rules to the new Caching Rules, but I must be missing something.

I have a set of static (ending in .html) URIs that I want cached, except if one of them ends in “2024e”. My site is set up to cache all static pages, and I also put in a custom Caching Rule for this particular directory (probably unnecessary, but I used to have a page rule that did the same thing).

In other words, I have two rules:

  1. http.request.full_uri eq “https://myurl.com/directory/file2024e.html” → Bypass cache

  2. starts_with(http.request.full_uri, “https://myurl.com/directory/”) → Eligible for cache

When I go to the page via Google Search Console, it tells me that the first page is a Cache Hit.

Am I missing something? This used to work perfectly under the old Page Rules.

Page Rules stop once a rule matches. Cache rules are all processed, so your second rule overwrites the action of the first.

HTML files are not cached by default so you can remove the first rule (or leave it if you want it as a reminder).

Set the second rule to…

((starts_with(http.request.full_uri, “https://myurl.com/directory/”)
and
(http.request.full_uri ne “https://myurl.com/directory/file2024e.html”))

(note the last expression is ne for “not equal” to exclude it)

Swapping the order should work, but better to be explicit I think.

1 Like

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