CDN Cache Invalidation - Query String Support?

Eric Wiley asked on June 15, 2015 21:06

When leveraging a CDN (azure or cloudfront in this case), we know that the default expiration for assets is around 72 hours. This doesn't work well for a site with constant CMS activity and lots of administrators uploading (and changing) images.

Knowing that we can't purge the CDN endpoints, is it possible to append a querystring on the end of an asset uploaded to the media library?

Example: http://[azureendpoint]/[containername]/image.jpg?v=1

Note, I know that I can add a querystring to the image in markup, but I would hope the media library can do this for me.

If a querystring doesn't work, what method would you recommend for cache invalidation/expiration?

Recent Answers

Filip Ligač answered on June 28, 2015 16:45 (last edited on June 28, 2015 16:46)

Hello Eric,

Using query strings may be one way how to enforce CDN to update cached content. However, you would need to make some customizations in Media library to ensure there is a unique query string added everytime you update the file.

With that being mentioned, at least for Azure CDN, it is possible to configure time-to-live of files stored there. Please see the following article which describes the web.config key that enables you to change TTL for files stored in CDN - How to Manage Expiration of Cloud Service Content in the Azure Content Delivery Network (CDN).

Best regards,

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.