Purged cache for URL but CF still serves an old version via XHR/AJAX

A similar problem is described here: Problem with AJAX and cache and the solution was never presented.

I explicitly purged the cache for an URL, but when I access it via AJAX (XHR request) CloudFlare still serves the old version.

When I open it directly in the browser - it’s the updated version. Tried different browsers, private modes, even different machines. It’s not the local cache it’s cloudflare’s.

The URL is https://cdn.jitbit.com/helpdesk/help/api.md

If I edit the “cache everything” rule for this URL to “bypass” it starts working, but as soon as I change it back - it serves the cached version again!

This makes me think it’s not actually being purged. I’ve seen other posts where users got a “Success” message, though I don’t think Cloudflare cares if it’s a valid URL or not.

For example, I just used the dashboard to purge https://example.com/foobar, and I got a success response.

It IS being purged since requesting the URL “plainly” via web-browser gives me updated content.

Something on CF’s side looks into a different cache store for AJAX requests. Maybe they use some key-value storage where something is added to “key” for ajax-requests.

“Purge everything” worked fine.

The cache key includes the Origin request header. Look at the request headers for the asset in question. If there is an Origin request header, you need to include that in the purge request, and not just the URL.

Important! A single-file purge performed through your Cloudflare dashboard does not clear objects that contain … An origin header

1 Like

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