Hi all, I’m struggling to understand how the ordering of page rules work…
We currently have the following page rules:
*example.com/section1/* Browser Cache TTL: a year, Cache Level: Cache Everything, Edge Cache TTL: a month
*example.com/section2/* Browser Cache TTL: a year, Cache Level: Cache Everything, Edge Cache TTL: a month
So we have Section 1 and Section 2 completely cached - including all PHP files (There is nothing dynamic in there anyway)
What we want to do now is add this page rule:
*example.com/* Browser Cache TTL: a year, Cache Level: Cache Everything, Edge Cache TTL: a month, Bypass Cache on Cookie: cookie1|cookie2
Which will cache everything on our site - the index.php, etc.
BUT – when the cookie is present in rule 3, we still want rules 1 and 2 to function - so even if the cookie disables the cache on /index.php, if a cookie user goes to example.com/section1/ We still want everything to be cached (including all php files)
Page rules are interpreted from top to bottom - so your more specific rules must always go at the top.
Hence you want 1,2,3 here.
Remember only a single rule can match at any one time - there’s no “additive” effect - the rule that matches first (from top to bottom) wins. Hence your bypass cache on cookie rule would be ignored for requests that match either rule 1 or 2.
The rules are interpreted in order and only one rule can match for a given request. Therefore, it would be impossible for Rule 3 to “wipe out” rules 1 or 2, since rules 1 and 2 run before 3.