Purge pages when the origin publishes a change
Send a purge from your publishing system when content changes: by URL on every save, and by wildcard only when images change.
You make a publishing system, such as a CMS, a commerce platform, or a build pipeline, purge the pages it changes through the Azion API or the Azion CLI, and send the same purge by hand from Azion Console. For a one-off purge of any type, refer to Purge cached content.
A published change reaches visitors only after the cached copy leaves the cache. The publishing system knows which pages changed, so it sends the purge the moment it saves them, and the cache TTL stays a safety bound for a purge that is missed.
- On every save, the publishing system sends a URL purge for the changed page and the pages that list it.
- Only when the save changes images, it also sends a wildcard purge for every size and format of those images.
- Each purge appears in the purge history when it is complete, and the next request for each object reaches the origin.
Prerequisites
- A domain that belongs to your account, served by an application. A purge of any other domain is rejected with error
30003. - A personal token for the API and the CLI. A token expires 1 day after it is created unless you choose a longer expiration, so set one that covers the time the publishing system runs, and replace the token before it expires.
- The Azion CLI installed and authorized, for the CLI procedure.
- Access to Azion Console, for the Console procedure. Refer to Access Azion Console.
The examples purge the product page https://www.example.com/products/blue-shirt, its category page https://www.example.com/category/shirts, and the images under www.example.com/media/blue-shirt. Replace them with the objects your save changes.
Purge the changed pages on every save
A URL purge removes the exact URLs it lists. It is not recursive, so list each page the change affects: the page itself and every page that shows the changed content, such as a category page or a home page. One request carries up to 50 URLs. A URL without a scheme purges both the HTTP and the HTTPS copies.
To send the URL purge by hand:
Access Azion Console > Products Menu > Real-Time Purge.
Enter one URL per item: https://www.example.com/products/blue-shirt and https://www.example.com/category/shirts.
A message confirms the creation, and Azion queues the purge.
The listed pages leave the cache once the purge propagates. A URL purge does not reach the copies that vary by cookie, device group, or image format, which the next section covers for images.
Purge image variants when an image changes
Image Processor caches one copy of an image per size and per format, and a URL purge reaches none of those copies. A wildcard purge ending in * reaches all of them. Send it only when the save changes an image: Azion accepts 2,000 wildcard purge requests in a 24-hour interval, and a wildcard on every save of a large catalog can reach that bound. One request carries one expression of up to 256 characters.
To send the wildcard purge by hand:
Access Azion Console > Products Menu > Real-Time Purge.
Enter www.example.com/media/blue-shirt*.
A message confirms the creation, and Azion queues the purge.
Every size and format of the changed images leaves the cache. When the publishing system knows the exact variants it serves, a cache key purge that lists each key does the same work without counting against the wildcard bound. A key carries the processing arguments after ? and the format after @@, as in httpswww.example.com/media/blue-shirt.jpg?ims=400x@@webp. For the format, refer to Cache keys.
Confirm the purge completed
A 201 from the API means the purge was accepted, not that it has propagated. Azion lists a purge in the purge history when it is complete. To confirm it:
Access Azion Console > Products Menu > Real-Time Purge.
The history lists each completed purge, and it can be filtered by the user who made it, the time, the argument list, the purge type, and the method. Filter by the argument list to find the URL or the expression you sent.
The response carries MISS, because Azion fetched the page from the origin again:
The purge is in the history, and the page served after it is the version the origin published. The request after it carries HIT again.