How to Purge an Azure CDN endpoint
In this Azure tutorial, we will learn how to Purge an Azure CDN endpoint, and setting cache-control headers using Azure storage explorer.
Due to frequent updates on the website or web application, or due to quickly updates, CDN edge nodes will cache assets until the asset’s time-to-live (TTL) expires. TTL sis determined by the cache-control header in the HTTP response from the origin server. After the asset’s TTL (Time-to-live) expires, the content is refreshed and a new copy of the Website or assets will be retrieved and served to the client. To remove cached content from all edge POPs to retrieve fresh assets immediately from the origin, we must purge an Azure CDN endpoint manually.
Purging an Azure CDN endpoint only clears the cached content on the CDN edge servers. To Purge an Azure CDN endpoint follow the steps given below.
- Navigate to Azure portal and select your Azure CDN profile that containing CDN endpoint.
- Now navigate to your Azure CDN profile and click on Purge button as shown above.
Select endpoint from the dropdown list and select Purge all check box, otherwise, type the file path of each asset that you wish to purge. We can purge individual asset by specifying the URL. For wildcard purge use asterisk (*) to purge all folder, sub folders and files under an Azure CDN endpoint.
- Now click on Purge button.
Purge request takes approximately 2- 3 minutes to process with Azure CDN from Verizon.
Setting cache-control headers using Azure storage explorer
Using Azure Storage explore, we can view and edit Azure Blob storage resources properties like ‘CacheControl’. Now we are going to set the Cache-control header on a blob in Azure storage. Follow the steps given below for setting cache-control headers using Azure storage explorer.
Select your Operating system from the drop down and download Storage Explorer for free. After downloading, install in your local system.
- Using Azure Storage explore, we can access multiple accounts and subscription across Azure, Azure stack and the sovereign cloud.
- We can create, delete, view and edit storage resources.
- We can view and edit Blob storage, Queue storage, Table storage and File storage.
Open Microsoft Azure Storage explorer in your Mac, now we must connect Microsoft account with Storage explorer using Microsoft email username and password.
- Navigate to Storage accounts (tutorialkart) | Storage container (blob container).
- Select a blob container, then select properties from the context menu.
- Now scroll down to the CacheControl property, if not present click on Add metadata and Enter “CacheControl”.
- Enter a value and click on Save button.