If I wanted to set up Sitecore to use CloudFlare (or an other CDN) how would I enable personalisation? Would I have to exclude any pages using personalisation from being cached by the CDN, or is there some other way to handle this?
I'm on a proof of concept for the same question at the moment this week.
What i'm doing:
1. no caching for personalisation
- Set Cache header for all pages ==> Hit from Cloudfront
- Set No Cache header for pages with personalisation. ==> Miss from Cloudfront
- (Currently testing)
- Set a Cookie with the Value of a rule
- Whitelist that cookie in cloudfront
- in the mvc:requestbegin pipeline. Ready the cookie value and set the matching value in sitecore.
- make sure that there are not to many possibilities. Or else it will get to many misses from the cdn.
With these changes the following page will be served from cloudfront:
- Pages with no personalisation
- Pages with a specific rule.
There is a whitepaper from Nick Hill that has further information. http://blog.boro2g.co.uk/personalization-at-scale-whitepaper/
It truly depends on how the CDN is setup. The way we have done it is that its transparent and has nothing to do with Sitecore. If an image/asset (js/css/docs) are requested by the end user, the first request goes to Sitecore and the subsequent requests go to the CDN.
If you change an image due to personalization reasons, again the first request will go to Sitecore and any further requests for that asset will go to the CDN.
CDN setup is crucial and depends on the way you implement it. We choose not to integrate it into Sitecore.