How to expire a cache on Aliyun (Alibaba Cloud) CDN using all files last update date?

66 views Asked by At

I'm running a static blazor WASM app and when I update the files, Aliyun continues to serve the old files causing the app to crash.

I tried to do this manually using the CDN/Refresh and Prefetch method in the console which works, but since my CDN is a wildcard domain https://*.xxx.com I can't manually each subdomain when the blazor app is updated. And when I try to use a regex, it won't accept https://[a-z]+[.]mydomain[.]com/ because "Only the four specified regular expressions are supported. Characters such as * + {} [ ] \ ^ | must not be included." - and when I tried to use one of the allowed regex expressions such as https://[^/]*.mydomain.com/ it reports and error also.

Someone mentioned that I could set up a trigger (PutObject) using a function, but I can't get this to work.

1

There are 1 answers

2
wanghq On

Is your app stored in Alibaba OSS? If so, you can setup a function trigger . Whenever you update the files, the change trigger a function execution. The function can call CDN API to refresh caches.