Posted 26th of October 2012 by Kern Herskind Nightingale

Great news - or should I say old news!?

Apparently Amazon CloudFront have added support for query string forwarding for custom origin distributions. This feature was announced approximately two weeks after I had written this lengthy blog post on how to mitigate this deficiency when using CloudFront and Sitecore with dynamic media URLs.

With the introduction of query string forwarding you can you can drop all the rewriting and just set the Media.MediaLinkPrefix (or do something slightly more elegant). Remember to configure the cache HTTP headers for Sitecore media:

<!-- allow proxies to cache -->
<setting name="MediaResponse.Cacheability" value="public" />
<!-- lifetime 12 hours -->
<setting name="MediaResponse.MaxAge" value="0.12:00:00:00" />

The last thing to do is to go to the AWS management console and edit the behaviour setting on your custom origin CloudFront distribution to ensure query string forwarding is enabled.

AWS CloudFront distrubution configured to respect query string parameters

This set-up is a lot lower in complexity than my initial post and it is much more in line with what I initially had hoped for when I started researching using CloudFront with Sitecore. This approach does not have any considerations around edge cache invalidation (cache beyond time-out) - this would probably need to be addressed production use.



blog comments powered by Disqus

About the author

Kern is a Sitecore Specialist with more than 10 years experince achitecting and developing Sitecore solutions. Kern was awarded Sitecore MVP in 2009, 2011 and again in 2015.
Currently Kern is helping the Sitecore Product team in shaping the future of the platform.

Kern Herskind Nightingale