i just installed cloudflare WP plugin and enable APO in the setting (tick Cache By Device Type)
but i realize that once we publish a new post, my site home page did not appear the new post.
its because cache issue.
currently after we publish a new post, i have to manually select purger everything in CF to get my post updated in website.
how can i solve this issue?
1 Like
simon
June 20, 2021, 2:38pm
2
This is a known issue with cache by device type - follow this issue on github and it’ll be updated when it is fixed:
opened 09:15AM - 09 Apr 21 UTC
closed 10:58PM - 10 Oct 21 UTC
### Confirmation
My issue isn't already found on the issue tracker.
I have repl… icated 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](https://github.com/cloudflare/Cloudflare-WordPress/blob/f87045b0227de24e57af4d4d88d88583afa0468d/src/WordPress/WordPressClientAPI.php#L59)" 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_
For the time being, you’ll have to continue to purge the cache manually.
2 Likes
system
Closed
June 23, 2021, 2:38pm
3
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.