Cache Rules have significant delay on applying

Hi there.

To cache MediaWiki pages on the Edge, I set up two Cache Rules as below:

Bypass Cache:

    http.host eq "wiki.example.com" 
 and (
    starts_with(http.request.uri.path, "/wiki/Special:")
 or ((http.cookie contains "example_com_wikiUserID") and (http.cookie contains "example_com_wiki_session") and (http.cookie contains "example_com_wikiUserName"))
)

Basically, when wikiUserID, wiki_session and wikiUserName are present, the request will be recognized as logged in user and get bypassed.

Eligible for Cache:

http.host eq "wiki.example.com" and (
    http.request.uri.path eq "/load.php"
    or ( (starts_with(http.request.uri.path, "/wiki/") or starts_with(http.request.uri.path, "/history/")) and (not http.request.uri contains "?"))
)

Then I set up to cache these pages.

When a page is eligible for cache, the server will cooperatively send its Cache-Control header:

cache-control: s-maxage=18000, must-revalidate, max-age=0

Now say I’m new to the site and I want to login. I went through /wiki/Special:Login where it takes me to a ride of requests and assigned me wikiUserID, wiki_session and wikiUserName cookies.

I took those cookies and went ahead to visit /wiki/Main_Page.

Bummer. The site shows that I’m not logged in because

CF-Cache-Status: HIT

I go to Cloudflare Dashboard to purge everything. Now it is back to normal.


Moreover, when I logged out, and the server clears the cookies for me, I’m still receiving

CF-Cache-Status: BYPASS

unless I visit the page in the incognito window once.