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?
2 Answers
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.
-
Thanks for the answer @ASURA. I understand how the CDN would cache different images, but obviously the html referencing the image would have to change too!. What happens if we have personalisation on the homepage which can swap out some carousel slide depending on the user engagement status? The URL accessed is obviously the same, the thing differentiating between different variants of content is a cookie from the user's browser. Can this be handled by the CDN, or would you simply disable pages with personalisation from being cached by the CDN? Commented Oct 12, 2016 at 7:42
-
The html portion of you website cache is handled by asp.net and Sitecore. As long as you publish, typically the html cache should be cleared. The components which would need personalization should be carefully vetted to see the type of caching to use.– ASuraCommented Oct 12, 2016 at 15:18