Quantcast
Channel: blog.atwork.at
Viewing all articles
Browse latest Browse all 1118

Force a content refresh of an Azure static website using Azure CDN

0
0

Static website hosting in Azure Storage is really cool and quick method for simple deployment scenarios. Azure CDN edge nodes provide the cache and distribution layer with custom domains, rules, and further configuration options for such a static website. But what to do if you update the static website and it doesn't deliver the new content? How can you force an update? See the solution here.

In this sample, we have a community website www.cloudusergroup.at running in Azure. You can find out how to create and to deploy a static website on an Azure Storage Account at Static website hosting in Azure Storage and a tutorial at Tutorial: Host a static website on Blob Storage. In this case, the website has a custom domain bound to the website with Azure CDN, see more at Quickstart: Integrate an Azure Storage account with Azure CDN.

Once deployed and configured, we have the static website up and running in Azure CDN with some basic rules, like redirection of HTTP to HTTPS and so on. In the Azure Storage Account, the Azure CDN is configured with an *.azureedge.net endpoint as here:

image

The quick solution to force a content update of the website that is called by the CDN is to purge the cached content from all edge nodes as described at Purge an Azure CDN endpoint. In the endpoint overview, click the "Purge" button. Then, confirm the "Purge all" checkbox and click on the "Purge" button at the bottom pf the panel as here.

image

This process usually takes about one to two minutes. The notifications show the success of the purge operation.

image

The Azure CDN will now immediately retrieve the new assets for the next client requests. Try it out and open the website, here www.cloudusergroup.at. You will see that the first request takes some time because the website is completely reloaded - but now with the most recent data from the storage and from the $web folder. As expected, all subsequent requests are served very, very quickly from the CDN cache.

I hope this quick tip helps if you're wondering why you're not getting the latest content from a freshly updated static Azure website and how to solve it!


Viewing all articles
Browse latest Browse all 1118

Latest Images

Trending Articles