Wp-admin is partially cached despite page rules


#1

Hello everyone!

I’ve been trying to force my wp-admin area to work with CloudFlare for few weeks, but without any success. Short description:

  • I have a WordPress blog, self-hosted
  • I want to work with the whole dashboard without problems with cache
  • I’ve created page rules:
    emilwypych.com/wp-admin/ - cache: bypass
    *emilwypych.com/preview=true - cache: bypass

Almost everything works fine. Almost. The preview works fine, most of the dashboard too, but I have a problem with posts. When I go to the posts section, the whole section is cached without any reason. Everything under that link: */wp-admin/edit.php is cached. BUT, if I click in the posts section on “All”, “Draft” or “Published”, content is not cached - then I can see real situation.

Example:

I’ve just published a post. When I go to Posts -> All I see that post is published. But if I go just to the Posts I see that post has “draft” status (what is wrong). And also I see that count near “Draft” shows “1”. If I click on “Draft” - surprise, there is no drafts!

Problem also appears when I try to edit published post just after publishing. Wordpress shows to me DRAFT. Wordpress thinks that post has not been published yet. I cannot do anything, I must wait until all caches expire. Cache purging and clearing my browser cache doesn’t resolve the problem. I hadn’t had such problems before I enabled CloudFlare, so for sure problem is caused by bad CloudFlare configuration on my side - I think I don’t know what should I do.

Can anyone tell me what should I do? Another page rules?


#2

Ugh, I should have placed page rules in the code block…

There you have proper page rules:

*emilwypych.com/wp-admin/* - cache: bypass
*emilwypych.com/*preview=true* - cache: bypass

#3

Weird. I haven’t noticed that on mine. My admin rule is *example.com/wp-admin* (no slash after admin). And make sure this Page Rule is first in your Page Rule list.

As you troubleshoot this, it helps to use your browser’s Dev Tools to look at the cf-cache-status header for each of your resources.


#4

Thank you for your reply. I also tried something like this:

*emilwypych.com/wp*

but also without success. I will try to set in your way. Of course, that page rule is set as the first one.

Headers are also… weird. When I go to posts (wp-admin/edit.php) I see the following headers in response:

cache-control: no-cache, must-revalidate, max-age=0
x-cache: HIT

but there is no cf-cache-status. But when I go to “All”, “Draft” or another “tab”, headers are like these:

cache-control: no-cache, must-revalidate, max-age=0
x-cache: MISS

The same situation is when I try to edit post. x-cache: MISS

But cache-control: no-cache means that - according to RFC - page should be revalidated. So if there are any changes on the page, CloudFlare should serve those changes. Right?


#5

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