delivering a different response based on region
We have a multi-national website. We want to load two JS files let's say test1.js and test2.js on our website based on the user location. The user location is being detected using Akamai EdgeScape headers. Let's say if the user location is China, we want to load test1.js otherwise test2.js should load on the page. The requirement is to load these JS files on server-side, not client-side. These JS files will be included at template level so that they are present in every page on the website.
The problem is: Let's say a user in Country A requests a page /abc.html, the page is served; cached at dispatcher and cached at Akamai edge server (near to user's location) with test2.js present in page source. Now another user requests the same page /abc.html, from China. The page is not available in Akamai edge server (near to user's location i.e. China), so Akamai edge server is going to fetch the page from dispatcher and dispatcher is going to serve the cached page which has test2.js in cache and this defeats the whole purpose.
Points:
1) We can't disable caching pages at dispatcher because it is not one page we are talking about, it's whole site.
2) The file can't be loaded on the client-side because of some purpose.
Thanks in advance!!