0

I have a custom domain pointing to a static webside using Azure CDN. After a deployment my website was no longer showing up. This was because and old version of index.html was being served from the CDN itself.

I fixed it by purging the CDN manually, but this is not ideal because I frequently update the files for this website via a build process.

What is the best practice to avoid this outcome? Do I need to add a purge to the build process itself or is there a better way?

Xander
  • 9,069
  • 14
  • 70
  • 129

1 Answers1

0
  • We must configure the max-age to control Cache-Control header.Azure CDN makes use of the header's duration value.

  • Add Cache-Control header in index.html - public, no-cache

  • All Cache-Control directives are supported by Azure CDN Standard/Premium from Verizon and Azure CDN Standard from Microsoft.

In Azure Portal => Your Static Web App => Configuration => Application Settings, ads the below settings Set the WEBSITE_LOCAL_CACHE_OPTION to Never and WEBSITE_DYNAMIC_CACHE to 0

Reference taken from Doc

Please refer Manage expiration of web content in Azure CDN for more information

Harshitha
  • 3,784
  • 2
  • 4
  • 9