Purge clears the CDN resource cache. Use it when content on the origin is updated and waiting for natural cache expiration is not acceptable, or when CDN servers are serving stale content.
Three purge methods are available:
Purge by URL to remove specific cached files without affecting other content.
Purge all to remove all data from the cache.
Purge by pattern to remove content selectively by specifying path patterns with the * operator.
Customer Portal cache purge
1
Open Purge request
In the Customer Portal, navigate to CDN → Purge → Purge request.
2
Select a CDN resource
Select the relevant CDN resource from the dropdown menu.
3
Select a purge method
Click the radio button next to the purge method, configure it as described below, then click Purge.
⚠️
Two purge requests per resource per minute are allowed. One purge request is limited to 100 URLs, so up to 200 files can be removed from the cache per minute.
In the text area, specify one or more content URLs to purge, entering one URL per line. Each path must:
Start with a slash (/).
Not include a protocol, domain name, or wildcard (*).
Include query strings if the CDN resource cache is configured to consider the query string.
To purge https://www.example.com/pictures/icon.jpg?size=small, enter /pictures/icon.jpg?size=small.
Click Show more under the text area to see additional recommendations.
Avoid this method in the cases below:
A Vary HTTP response header is present on the origin. Purge by URL deletes only one version of the file.
When Large files delivery optimization is enabled, Purge by URL removes only the first cached byte-range slice, which starts at byte 0.
The behavior of Purge by URL also depends on the Ignore Query string option:
If the value is Ignore All, do not include query parameters in the purge request.
If the value is Ignore All Except, only files with the parameters listed in the option are cached as different objects. Files with other parameters are cached as one object. In this case, include the listed parameters in any order. Do not include other parameters.
If the value is Ignore Only, files with the parameters listed in the option are cached as one object. Files with other parameters are cached as different objects. In this case, include other parameters (if any) besides the listed ones in any order.
Click Purge to apply.
⚠️
One purge request per resource per minute is allowed. After a full purge, subsequent cache misses cause CDN servers to fetch content from the origin, which can sharply increase origin load. For large amounts of content, use Purge by URL or pattern instead.
Select Purge all and click Purge.
⚠️
One purge request per resource per minute is allowed. One purge request is limited to 10 patterns.
In the input field, enter path patterns without a domain name. Use the * operator to match any number of characters. Each path must start with / and be on a separate line. If a query string is not included in a pattern, the purge covers all query string variants of matching files.
For example:
Target
Pattern
One file (all query string variants)
/static/image.jpg
All files in a folder
/static/*
Files by extension
/static/*.jpg
Files under a matching path segment
/img/*/files
Files by extension under a path
/img/static/*.jpg
To target a file with a specific query string, include it in the path: /static/image.jpg?VERSION.
Click Purge to apply.
Purge history
📝
Purge history stores requests for the past month only.
Navigate to the Purge history page and filter the requests.
Filter
Description
Search by CNAME
CNAME of the CDN resource
Type
Purge by URL, Purge all, or Purge by pattern
Status
In progress, Successful, Failed, or Status report disabled
Date
Time period up to one month
📝
When CDN caching is set to CDN controlled and Cache expiry to Do not cache, the CDN does not cache content, and the purge status changes to Failed after 45 minutes.
Purge the CDN cache by URL, pattern, or all, and retrieve purge history via the REST API.
Set the required environment variables. The CDN resource ID is available in the Customer Portal under CDN → CDN Resources, or via the List CDN resources API call. In the SDK examples, 12345 is that resource ID.
Remove specific files from the CDN cache. Two purge requests per resource per minute are allowed; one request is limited to 100 URLs. URLs must start with / and must not include the protocol or domain name. Include query strings if the CDN resource caches content per query string.
from gcore import CDB
client = CDB() # Reads GCORE_API_KEY from env
client.cdn.cdn_resources.purge(
12345, # CDN resource ID
urls=["/images/logo.png", "/css/style.css?ver=2.0"],
)
HTTP 201 means the request was accepted. The response body echoes the submitted URLs. The purge finishes later, and its status is in purge history: In progress, then Successful or Failed.
Remove files matching a path pattern. Use the * operator to match any number of characters. Patterns must start with /. If a query string is not included in a pattern, the purge covers all query string variants of matching files. One request is limited to 10 patterns; one purge request per resource per minute is allowed.
Remove all cached content for a CDN resource. One purge request per resource per minute is allowed. After a full purge, subsequent cache misses cause CDN servers to fetch content from the origin, which can sharply increase origin load. For large content sets, use purge by URL or pattern.
HTTP 201 means the request was accepted. The response body echoes an empty paths array. The result appears later in purge history.
{
"paths": []
}
Purge history
Retrieve the history of purge requests for the past month. An HTTP 201 response only accepts a purge. Find that request here by CNAME and path, and read status. Filter by CNAME, purge type, status, or date range.
📝
When CDN caching is set to CDN controlled and Cache expiry to Do not cache, the CDN does not cache content, and the purge status changes to Failed after 45 minutes.
from gcore import CDB
client = CDB()
history = client.cdn.list_purge_statuses(
cname="cdn.example.com",
purge_type="purge_by_url",
limit=50,
)
for entry in history:
print(entry.purge_id, entry.purge_type, entry.status, entry.created)