Under normal conditions, the lifetime (TTL) of an object in the CDN cache should be determined by standard HTTP caching headers like Cache-Control produced by the origin(s). In certain situations, however, specific URLs may be required to be removed from the cache so that a fresh copy of the content can be fetched from the origin. This could happen for example when:
- A specific file on the origin was damaged or malformed at the time when it was cached, it has now been fixed and the CDN needs to get the new fixed version of that file.
- Some files on the origin with long TTLs were changed because of a site re-design or major upgrade and the CDN needs to re-cache those files to reflect the changes.
- A copyright claim has been issued about a specific file and, regardless of its TTL, the file needs to be removed from the cache as soon as possible to comply with the law.
This process is called invalidation and can be accessed through the Invalidate option at the bottom of the main menu on the left of the dashboard. Invalidations are resource-intensive operations and should only be used on occasion, never as part of the normal workflow of the distribution.
This is especially true for Multi CDN distributions, where invalidation requests and their completion status need to be communicated with 3rd-party platforms. For that reason, invalidations can take up to a few minutes to complete and are restricted in the following ways, to ensure the proper function of the CDN platform:
- There is a limit on the frequency of invalidation requests. Each customer is allowed to submit at most one request every minute.
- An individual invalidation request can contain up to 75 URLs. This allows a batch of invalidations to be requested by a single action.
- There are fair-use policies in place to ensure that a single customer cannot overwhelm the invalidation request queue. A customer who submitted just 1 request will not have to wait for another customer’s 100 invalidation requests to complete first.
To request an invalidation:
- Click on the Invalidate menu item on the dashboard’s main menu
- In the screen that appears, type in the desired URL in the “Invalidate URLs” field and click on Add URL
- Every added URL will appear directly below, in the “Invalidation list”
- As already mentioned, you can add up to 75 URLs to the invalidation request this way.
Using the Invalidation list, you can review the URLs destined for invalidation before actually submitting the request. The list allows you to un-check any URLs you wish to remove from the request, in case you added the wrong URL by accident. The invalidation request is finally queued for processing when you click on the button Submit invalidations.
All already submitted invalidation requests are then shown in the last pane of the page called Invalidations. For each request, an ID is displayed, which can be used for tracking purposes, as well as its status. Invalidation requests that are waiting their turn to be processed in the queue show as Pending, and this can last a few minutes depending on the type of distribution and the size of the current invalidation queue. After the invalidation request is processed, its status will be automatically set to Complete or Error depending on whether it succeeded or not.
In the Action(s) column, you can click on the Details button to see more information about which invalidations succeeded, which failed and why. It is possible for an invalidation request to expire if it remains pending for too long, in which case it will receive the status Expired. Such requests can be re-queued for processing if you click the right-most Re-submit action button.