Azure CDN purge not refreshing cached content (Premium Verizon)
AZURE CDN (Verizon - Premium)
I have an Azure CDN (Verizon, premium) connected to blob storage. I have 2 rules in place based on some steps tutorial. The rules are designed to force the CDN to serve "index.html" when the root of the CDN is called. They may or may not be relevant to the issue, and it's not working so how it will work?
Thanks to Stackoverflow Genius who help to sort this issue,
After working with Microsoft and Verizon Digital Media support for a number of weeks, they finally figured out the solution.
In order to avoid interfering with the purge process, the easiest method is to implement the following "IF" statement before the "Features" portion of your rule:
IF | Request Header Wildcard | Name | User-Agent | Does Not Match | Values | ECPurge/* | Ignore Case (checked)
This if statement will skip this rule altogether for requests made with the purge user agent, allowing the request to hit the CDN as normal.
Solution # 2
With this similar setup (Azure CDN/Blob-Static-Site/Verizon), I was having a cache issue too. I happened to have only 1 URL rewrite rule. What solved it for me was to set a subsequent rule regarding the caching/Max-Age.
Here's how I did that: Azure Portal -> CDN profiles -> Click your profile (Overview section)
- Click the manage icon in the Overview (in the details section/blade). This should open the craptastic Verizon page.
- Hover over "HTTP Large" and then click Rules Engine
- Enter a Name/Description in the textbox. For example: "Force Cache Refresh" Leave If/Always selected
- Click the "+" button next to Features
- In the new dropdown that appears choose "Force Internal Max-Age" (leave 200 as the response)
- Enter a reasonable* value in the field for seconds. (300 for example), Click the black Add button
It says it could take 4 hours for this rule to work, for me it was about 2.
Lastly, for this method, the order of the rules should not matter, but for the above rewrite rules keep in mind the rules do allow you to move them up and down in priority. For me, I have, Https redirect first, Url rewrite (for "React-routing") 2nd. and lastly Force Cache Refresh last.
* note: This is a balance since purge is not working for me, you want the static (app/site) to update after you publish, but you don't want to have tons of needless traffic to refresh the cache either. For my dev server, I settled for 5 minutes. I think production will be 1 hour... haven't decided.
So you don't need to hurry it take time, hope it may help you, still facing an issue? Ping me back