Cloudflare Showing Cached Pages Instead of Page Not Found

I have gotten disturbing complaints from users of some sites saying that after removing a post the page is still there. The only culprit I can think of is Cloudflare’s cache. I have been unable to reproduce the problem because whenever I load one of the URLs in my browser I see Page Not Found, but I am still getting complaints from users that they are still seeing the old content.

Is there a way to force Cloudflare to always show Page Not Found when that is current status of a post?

Just checking you’ve tried the “Purge Cache” option “Purge Everything” ? Depending on the cache TTL of the existing/old page, that might help :slightly_smiling_face:

I don’t always have time to respond to user complaints let alone click on purge everything. That is one reason why I allow users to remove stuff themselves. The problem is that when they do that they don’t always see that it has been removed.

I need Cloudflare to stop serving old cached pages in such cases without me needing to do anything.

You can do this with a custom purge, using the Cloudflare API you can send a custom purge request when the user deletes something.

See this

So, you’re saying I have to add code to the site so that Cloudflare is pinged in that way whenever a user removed something?

Why can’t I just tell Cloudflare to check the header of the live page before loading a cached page and direct it not to load a cached page if the live one returns a status code of 404. Cloudflare should be doing that automatically anyway.

Also, I disabled tiered caching because the site in question was the only one with tiered caching enabled.

Automatic Platform Optimization is still running and I suspect it could be to blame since this is the only site with APO running also.

Also, APO claims to make purge cache on update obsolete, but if that is true then how come a user updating the status of a Wordpress post to trashed not result in that outdated result being purged.

If you want no caching at all, you could create a page rule that disables it on a specific directory like

domain .com/images/*

1 Like

That would never work on Wordpress sites with a permalink structure like /post_id/permalink and I want caching of static assets. The idea is not to keep Cloudflare from caching anything, but to make sure the cache is purged when a user trashes a post. APO is supposed to automatically purge cache on update, but it doesn’t work on one of the most important updates of all (trashing).

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.