3

The Issue

I am currently building a PWA that is hosted on Azure and utilises Azure CDN Premium.

Within this PWA, we have the following files:

/service-worker.js
/js/translations/en-us.json
/js/translations/en-hk.json
etc...

When a release is deployed to the storage blob, we trigger a CDN 'purge' that is meant to tell the edge nodes to re-retrieve the assets from the origin storage account.

However, for some reason, the CDN is still returning old versions of these files, despite the storage account having the latest versions (I have left it over 10 hours so not a propagation issue).

Why is this happening? The whole point of a 'purge' is to empty the cache...

I appreciate that there may also be downstream caches beyond the nodes but I never have these problems with AWS and therefore I can only come to the conclusion that it is because Azure is either doing something badly, or I am misunderstanding how it is meant to work.

Possible Solutions

I have come up with possible solutions to this, however, because I am fairly new to Azure, I want to get other's opinions on what the best solution is...

Use Query Strings and Set the relevant Cache mode

I am aware that I could use just use query strings on these files (apart from service-worker.js), however, I do not feel confident this is the best solution.

Custom Rules Engine

Alternatively, I can define custom rules to instruct the CDN to skip the cache for certain files. This kind of defeats the purpose of a CDN though. Which goes back to the question, why is Azure not purging these assets properly...

If this is the best solution, please could someone advise me on the what rules I should define?

Ben Carey
  • 16,540
  • 19
  • 87
  • 169

0 Answers0