0

I have a setup a azure cdn that point to my webapp. while i am changing in my style sheet and deploying webapp, the styles are updating immediately. so is there no any rquiremtn for purge in this case? does in this case cdn automatically update styles from webapp?

I am working according to this article https://azure.microsoft.com/en-in/documentation/articles/cdn-websites-with-cdn/

Vivek
  • 1
  • 1
  • Normally the edge node will serve the items till their TTL. ( time to live) then it will get the latest and cache it. You need to purge CDN endpoints when you want to force the CDN to get the latest content and serve. – Aravind Jun 27 '16 at 09:54

2 Answers2

0

If the URL of the resource remains the same, the CDN servers (and the browsers) are free to cache them. So, if you are using CDN, you need to force a URL change every time the file content changes (commonly done by adding a version string). Since, it is working for you, either your files are not getting served from the CDN at all or somehow the URL is getting updated.

Look at the URL from where your style sheet is getting fetched (network tab in the browser's debugger). Make sure the URL path is actually from the CDN and not your website directly.

If you have a MVC.net app and you are using System.Web.Optimization.BundleCollection for style bundle, it add a query parameter to the URL embedded in the HTML and changes it if the file contents change. This ensures that the stale cached copies of the resources are not used.

See CDN and bundle caching sections at http://www.asp.net/mvc/overview/performance/bundling-and-minification

AVS
  • 531
  • 2
  • 13
0

No, CDN does not automatically update the CSS for webapp. To be safe, you should always purge.

CDN is a global service, you saw the CSS update doesn't mean everyone else all see the CSS update. Another IP address might still have the old CSS cached.

Besides, cache control header also plays a role here.