I’m having the exact same problem right now. I’ve narrowed it down to a single header: Origin. Which is why loading the URL directly works but it doesn’t through the website that originally got a 404.
It seems the Edge caches are using Origin as part of its cache key and it’s stuck with a cached 404. Purging caches doesn’t work.
This only started when I introduced a “Cache Everything” and “Edge Cache TTL” page rule so I think there’s something wrong on Cloudflare’s Edge that is delaying cache expiry for 404s, which in their docs, should be 3 minutes by default without any Cache-Control headers from Origin.
I set my Edge TTL to a month, so I’m guessing the 404 will clear in a month… For you (@dshenton) I’m guessing you had a lower TTL so it started working again.
For now, I’m going to explicitly add a Cache-Control: no-cache header, it should work. But this will be a problem for anyone that doesn’t have access to 404 pages (e.g. AWS S3).
Update: Adding a no-cache header to 404s doesn’t work. Cloudflare still HITs its cache and never BYPASSes.
I’ve also noticed Purging cache works for requests without an Origin header but does nothing on requests with Origin (i.e. they still HIT and their age continues to increase).
As expected, turning off Cache Everything solves the issue. But that’s not an ideal solution.
Update: I re-enabled Cache Everything and removed the Edge Cache TTL rule. That also works. So “Edge Cache TTL” seems to be the rule that overrides the 3 minute 404 response caches.