Purge one changed asset when a specific cached file is stale. A targeted purge avoids unnecessarily making every visitor fetch the entire site from the origin again.
IN THIS ARTICLE
What you need before you begin
Confirm the origin already serves the updated file. Record its complete public URL, including scheme, hostname, path case and relevant query string, and check whether custom cache keys or a Worker affect it.
01 Purge one changed asset from Cloudflare cache
- Open the domain’s caching Configuration page and locate Purge Cache.
- Choose Custom Purge and the URL option. Enter the exact affected public URL rather than a filesystem path.
- Review the entries and purge. If the URL redirects, purge the final asset URL too when that is the content that changed.
- Request the asset again and inspect its body and CF-Cache-Status. Compare the actual file content or version rather than only a timestamp in your local browser.
- Clear the relevant application or browser cache separately if it still serves an older copy. Prefer versioned asset filenames for future deployments.
02 Example: purge the exact logo URL used by the page
Suppose the page requests the following logo, but a recent content change is still hidden by the edge cache. First confirm that the origin serves the corrected image and that the browser is requesting this exact address.
https://www.example.com/assets/Logo.png?v=4
Paste that public URL into the single-file custom-purge field. Preserve the capital L and the version query when they are part of the actual cache key. A path such as /home/account/public_html/assets/Logo.png is a server location, so it is not the URL to enter. A wildcard such as /assets/* is not a single-file purge.
Expected result: a fresh network request retrieves the corrected logo. If the page has switched to v=5, inspect and test that reference instead. Review custom header/cookie cache keys separately, and remember that the purge does not remove a fresh browser-local copy.
Confirm the expected result
Fresh requests should obtain the updated resource, and eligible subsequent requests can refill the edge cache. Test the exact URL referenced by the page.
Troubleshoot unexpected results
Wildcards are not supported in a single-file URL purge. Custom keys involving headers or cookies may require an API purge that supplies the matching key values or another appropriate supported purge scope.
Does this clear a visitor’s browser cache?
No. It invalidates Cloudflare’s cached object. Browser caching follows its own headers and lifetime, so a new asset URL is often the most reliable way to publish a changed static file.