We are using Akamai to do A/B test, is there a way that Akamai can get different cache with some cookie value. For example: suppose I have 2 applications App-A and App-B under www.example.com, is there a way that when request has cookie "to-A=true" then go to the cache of App-A, and if cookie has "to-A=false"? then go to App-B? Thanks!
1 Answers
You could achieve this using Cache ID Modification behavior. You can enable the Include the following cookies action & mention your cookie name on the Elements to include field. Akamai will basically create 2 cacheID (ID's would be different though) for the resource & the cacheID will be constructed with the cookie name (&values if you say yes in Include values property). When the incoming request has these cookies set, then Akamai could serve the specific resource from the cacheID (that has the cookie value in its ID).
In your example, the Cache ID would be constructed like the below for the resource abc.js. The abc.js that came from Origin App A would be saved under to-A cacheID & the one from App B would be saved on the other.
X-Cache-Key:S/L/**/abc.js cid=_to-A=true_
X-Cache-Key:S/L/**/abc.js cid=_to-B=true_

- 78
- 5
-
thanks, using Cache ID for this like you said and solved my problem. – Yichen Mar 25 '17 at 09:58
-
How does Akamai behave for the first request when the cookie is not present? I understand the cookie will be added by the origin, and cache key formation happens even before hitting the origin. So when the first request comes, there is no cookie, and cache key wouldn't match. So there will be 3 cache id's that will be created ? – Prashant Onkar Aug 16 '18 at 14:26
-
1@PrashantOnkar If you want Akamai to cache the content even when the cookie is not present, I believe you need to set "Require Included Elements" to "Not required for caching". If you have that setting, I believe there will be 3 cache IDs as you say (or maybe a blank `cid` when cookie is missing). Note that I have not tested this. – Kelvin Sep 21 '18 at 21:25