azure cdn purge not refreshing cached content

*爱你&永不变心* 提交于 2019-12-04 07:44:43

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.

I also found if you purge each file separately, for example, put /css/main.css in 'Content path' when purging instead of 'purge all' it will work

is everything working now? I see that your rules are probably more complicated than you need. If the goal is just to have root "/" rewrite to /index.html, this is the only rule you would need:

If always URL Rewrite - Source: "/"; Destination "/index.html"

10/14/2019 - 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)

  1. Click the manage icon in the Overview (in the details section/blade). This should open the craptastic Verizon page.
  2. Hover over "Http Large" and then click Rules Engine
  3. Enter a Name/Description in the textbox. For example: "Force Cache Refresh"
  4. Leave If/Always selected
  5. Click the "+" button next to Features
  6. In the new dropdown that appears choose "Force Internal Max-Age" (leave 200 as the response)
  7. Enter a reasonable* value in the field for seconds. (300 for example)
  8. 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 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!