crowhill
crowhill

Reputation: 2548

Microsoft Azure CDN appears to only cache HTML

I have an azure web app. We'll say it's url is http://theapp.azurewebsites.net. I also have a CDN set up to serve that same app. It's url can be http://theapp.azureedge.net.

Both work. Both serve content fine. However, if I 'pause' the web app via the Azure console, the CDN url http://theapp.azureedge.net instantaneously stops serving images, css, etc, complaining that http://theapp.azurewebsites.net can't be found, but it still tries to serve the (now broken) HTML. That is, the CDN appears to only have a copy of the HTML and is trying to serve other content directly from the web app itself.

It's my understanding that

A) the CDN should have a copy of all page assets (images, css, etc.)

B) it should take the CDN a while to notice that the web app is paused and keep serving old, pre-pause content until the CDN nodes try to refresh from the web app.

C) If the CDN can't serve the images from the paused app, it shouldn't be serving anything from the paused app, including HTML.

Can someone clarify?

Upvotes: 1

Views: 547

Answers (1)

Erik Oppedijk
Erik Oppedijk

Reputation: 3551

A) The CDN doesn't actively load all resources, you have to do this: https://azure.microsoft.com/nl-nl/documentation/articles/cdn-preload-endpoint/ In your scenario the CDN would be mostly empty, until you manually have browsed all pages/resources

B) The CDN caches items for a fixed time (TTL) and halfway that time checks to see if the item has changed on the webserver. It seems your resources have a very low TTL (or even a no cache) which will result in a call to the webserver every time. https://azure.microsoft.com/nl-nl/documentation/articles/cdn-manage-expiration-of-cloud-service-content/

C) The CDN will serve everything from it's cache, it has no clue of an application being offline.

Upvotes: 1

Related Questions