I need to send different resources (specially images) for same urls depending on a complex logic based on different factors (cookie, IP, time, random). I want to take advantage of CDNs (cache, availability, proximity). So, I want this CDN to make a call to my server in order to decide which resource serve to any request. It is very important to not use redirects, so the user will never see a 30X status code.
For clarification:
- User makes a request to http://resources.mydomain.com/img/a.jpg, which domain is under CDN
- CDN makes a call to my server, sending url requested, cookies and user IP
- My server returns the name of the real resource to serve (http://hidden.mydomain.com/img/a-version3.jpg)
- CDN requests that image if not in cache
- CDN responds to user request sending a-version3.jpg data, but without any redirect
Is it possible using any current commercial solution?