SiteCore is one of the best .NET platform for large and scaliable deployment. It even worths more if you use together with CDN network in a front of.
Most of the people treat CDN as another cache somewhere in the someone’s cloud that improve site performance and allows them to store data near the end user.
It’s true howevere there is always a way to make it better and better. We all love SiteCore Analytics as a part of cool platfrom. It looks nice, provide good reporting system and it is really good alternative for Google Analytics.
By default most of the CDN network from SiteCore Analytics point of view looks like another visitor. It is all about a specific header being sent back to customer origin server.
Based on the official HTTP standard protocol any of the cache/proxy server send back request header containing X-Forwarded-For header or Via header. Main problem here is that depends on numbers of proxy/cache server this header might contains multiple value. If you use CDN network with mid-tier setup it’s default behaviour.
So, how to make it works and how to be sure that SiteCore Analytics works with real end-user IP?
Force your Proxy/Cache/CDN/Load balancer to re-write REMOTE_ADDR to another header:
- By default Akamai(might be any other CDN network) recommend ‘True-Client-IP’ (Configuration->EdgeService General->True-Client-IP Header).
- For proxy/cache/load balancers server please use module that allow you to modify Request Header. In example with Apache Load Balancer you have to add following entry into your host file:
RequestHeader Set True-Client-IP %{REMOTE_ADDR}e
And how to make it works with SiteCore Analytics? Please follow up on my colleague and .NET guru Adam Najmanowicz blog
http://blog.najmanowicz.com/2011/10/05/enable-sitecore-dms-analytics-behind-a-proxy-or-a-cdn/