Single File Purge Not Working Despite Success Response

What is the name of the domain?

ownly.biz

What is the issue you’re encountering

Single File Purge Not Working

What steps have you taken to resolve the issue?

I’m experiencing an issue with Cloudflare’s single file purge functionality. While the purge API returns a success response, the cache doesn’t actually get purged - subsequent requests return cf-cache-status: HIT instead of the expected MISS.

Here are my test scripts:

# Check cache status
% cat ./access.sh
curl -sIXGET $FILES | grep cf-cache-status

# Purge single file
% cat ./purge_file.sh
curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache" \
     -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN_PURGE" \
     -H "Content-Type: application/json" \
     --data "{\"files\":[\"$FILES\"]}"

# Purge everything
% cat ./purge_everything.sh
curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache" \
     -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN_PURGE" \
     -H "Content-Type: application/json" \
     --data '{"purge_everything":true}'

Test results:

# Purge everything works as expected
% ./purge_everything.sh
{
  "result": {
    "id": "599b3936cdeb8e95a7a564de943dffdf"
  },
  "success": true,
  "errors": [],
  "messages": []
}
% ./access.sh
cf-cache-status: EXPIRED
% ./access.sh
cf-cache-status: HIT

# Single file purge doesn't work despite success response
% ./purge_single.sh
{"success":true,"errors":[],"messages":[],"result":{"id":"599b3936cdeb8e95a7a564de943dffdf"}}
% ./access.sh
cf-cache-status: HIT

Since purge_everything works (the cache status changes), I believe my permissions, ZONE_ID, and TOKEN are correct. However, when executing the single file purge, I don’t get the expected cf-cache-status: MISS - it remains HIT.

I need to be able to purge individual files. Any assistance would be greatly appreciated.

May I ask if there is any caching configured at the origin or using some other 3rd-party cache service amongside Cloudflare? :thinking:

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