Cloudflare-WordPress: APO cache is not cleared properly.

Confirmation

My issue isn’t already found on the issue tracker. I have replicated my issue using the latest version of the plugin and it is still present.

WordPress version

5.7

Cloudflare-WordPress version

4.4.0

PHP version

7.4.0

Expected result

that the APO cache after a change / publish / etc really clears

Actual result

Only the desktop version cache is cleared

Steps to reproduce

Activate the plugin Activate APO Activate “Cache by device type” Create content. View the page with mobile and desktop (the order does not matter). Publish new content. Top up on mobile (nothing has changed: no new content) Reload on desktop (new content appears)

Additional factoids

I investigated the problem at length and here are my conclusions.

When the “zonePurgeFiles” method is executed with an array of 30 lines, it clears the cache well but not in mobile (tablet I have not checked).

I modified the request by adding the headers “CF-Device-Type” but nothing changes.

If I delete the url in the Cloudflare interface directly it clears all the caches on that page.

If I modify the request not to send an array but just 1 url like this (imagining that the first line $files[0] is my test url 😉):

$request = new Request('DELETE', 'zones/'.$zoneId.'/purge_cache', array(), array('files' => $files[0]));
$response = $this->callAPI($request);

the cache clears well.

Looks like the request by array does not clear the devicetype cache

References

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 76 (22 by maintainers)

Most upvoted comments

Disabling Cache By Device Type solves the problem but this time, mobile version of the site is served even in desktop mode.

Cloudflare rep sent me an email last week, I told them about this problem and no reply yet…

It has been a year god damn it! I’m being helpful here but you are not providing any fix. I have provided all the information you need.

@coolrecep When APO introduced the desktop and mobile version conflict issue was there and many complained then only they introduced “Cache by device type” which is solved the cache (desktop version in mobile and mobile version in desktop) conflict problem, but after that mobile version cache is not updating which we are all facing the issue now and complaining.

If we logged in to our account it’s showing the updated cache version, but if we are checking the site without logged in then it’s not showing the updated version.

Even If anyone is commented in the article, it’s not showing the comment, so we have to clear the particular article cache then only it will be visible to all.

I’m not sure why CF is taking so much time to fix the issue. If it’s a free service means we may not force them to do, but it’s a paid service but still they don’t care about it.

Even I have raised two tickets and explained everything and many like you explained and supported but no response.

It’s really disappointed and frustrating.

Unfortunately the change was reverted due to increased load on Cache purge infrastructure. We will engage with Cache and API team to find a solution for this issue.

Fixed for me after a year of wait. Thanks.

@girirajnet thanks for flagging this. The fix will work out of box for new customers who will activate APO “Cache by Device Type”. For existing customers the additional step is necessary:

  • after the upgrade to 4.6.0 please navigate APO card in Cloudflare plugin and make sure APO “Cache by Device Type” is activated.
  • after that any new content change should send purge requests both on desktop and mobile devices.

I recommend purge all Cache once to make sure you content is in sync for desktop and mobile variants.

@girirajnet please tell more:

  • Do you have APO’s “Cache by Device Type” option enabled?
  • Have you navigated to APO card in the plugin?
  • Have you purged all cache (won’t be necessary in all cases, but probably worth it to do once)?
  • Do you experience a different use case as @rvola originally described? It could be an additional use case we need to look into.

I hear the frustration (well earned) from you folks. At the moment our team is resource-limited and fully preoccupied with launching Cloudflare Images product. We are actively hiring to expand APO team so hopefully in September/October we be in the position to address purging issues for “Cache By Device Type” and extend APO functionality further (better caching rate, support for cdn-cache-control etc.)

Disabling Cache By Device Type solves the problem but this time, mobile version of the site is served even in desktop mode.

Cloudflare rep sent me an email last week, I told them about this problem and no reply yet…

It has been a year god damn it! I’m being helpful here but you are not providing any fix. I have provided all the information you need.

Yeah the cache by device is what I did but it aint ideal, if we been waiting a year already then I am stopping all my subs next month which I got several, finding a better solution its a shame but this ain’t good enough, cloudflare too big don’t care, it’s what happens sadly.

Disabling Cache By Device Type solves the problem but this time, mobile version of the site is served even in desktop mode.

Cloudflare rep sent me an email last week, I told them about this problem and no reply yet…

It has been a year god damn it! I’m being helpful here but you are not providing any fix. I have provided all the information you need.

It’s working fine now. Informed @sejoker as well.

@coolrecep if you get update and if its worth Pls share here. Thank You

Not working for me right now but I’m sure we’ll figure it out.

Thank You @coolrecep for the update. If it’s working, Pls don’t forget to update here 😃

My bad, I created a new private conversation here: https://community.cloudflare.com/t/apo-cache-purge-issues/291140

I had a look at APO purge issue when “Cache By Device Type” is enabled. I can’t reproduce the issue without more details ( purging of all variants works fine on our test setup).

There is a Cloudflare Purge API quirk for “Cache By Device Type”: when the purge happens it only purges for 1 particular device type variant not all of them. So internally APO team supports additional infrastructure to listen to Purge requests, detects “Cache By Device Type” and purges the remaining variations. I hope this explains why there is no special treatment of “Cache By Device Type” in the WordPress plugin.

Earlier mobile and desktop version VIEW were conflicting, so we were getting Desktop view in mobile and mobile view in desktop.

then Cloudflare has released Cache By Device Type, and it has solved the VIEW conflicting, but after that if we made any changes in the existing article or created an article, the cache is updating only in desktop version but not mobile.

This is the problem everyone is facing / complaining now. Hope CF will take serious action on this.

Thank You Giri

Not resolved after testing, still Only the desktop version cache is cleared

Thank You for the update. We have been waiting so long.