Faster Static Website Updates on Azure with CDN Purge

AshAsh
2 min read

When hosting a static website on Azure with Azure CDN, one common issue is that changes to our site do not show up immediately on the internet. Even if we delete all the old files and upload the new ones, the old version of our site may still be served for several hours.

Why Does This Happen?

Azure CDN (Content Delivery Network) stores copies of our static files in different locations worldwide to improve speed and performance. However, when we update our site, the CDN still serves the old files from its storage. This causes delays in reflecting our latest changes.

The Solution: Purge

To make sure our latest changes appear immediately, we need to purge the CDN. Purging clears the stored files across Azure’s CDN network, ensuring that the newest files are loaded when someone visits our website.

How to Purge in Azure?

Step 1. Go to Azure Portal home, then click on our static site’s storage account.

Step 2. In the left-hand panel, expand “Security + Networking” and click on “Front Door and CDN”.

Step 3. In the “Host name” column, click on the specific host to open its settings.

Step 4. Click on the “Purge” button at the top of the page.

Step 5. A pane will appear on the right-hand side. In the “Endpoint” field, select the endpoint from the dropdown list, tick the “Purge all” checkbox, and click on the “Purge” button at the bottom.

A notification will appear stating that the purge request is being processed.

Wait for the purge to complete, and after a few minutes, the latest version of our static website will be visible on the web.

0
Subscribe to my newsletter

Read articles from Ash directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ash
Ash

DevOps Automation Engineer with around 7 years of experience in CI/CD pipeline automation, cloud deployments, and process optimization. Specializing in Harness CD, I have streamlined deployments, automated processes, reduced manual efforts, and improved release workflows.