Wednesday, October 15, 2014

Testing CDN and geolocation with

Assume you want to migrate to a new CDN provider. Eventually you'll have to point as a CNAME to a domain name handled by the CDN provider, let's call it To test this setup before you put it in production, the usual way is to get an IP address corresponding to, then associate with that IP address in your local /etc/hosts file.

This works well for testing most of the functionality of your web site, but it doesn't work when you want to test geolocation-specific features such as displaying the currency based on the users's country of origin. For this, you can use a nifty feature from the amazing free service WebPageTest.

On the main page of WebPageTest, you can specify the test location from the dropdown. It contains a generous list of locations across the globe. To fake your DNS setting and point, you can specify something like this in the Script tab:


This will effectively associate the page you want to test with the CDN provider-specified URL, so you will hit the CDN first from the location you chose.


Scumola said...

Yea, they have an API. I hit our site with using a few different browsers every hour and collect all of their stats. It's good to look at every month or so to see if the "time-to-load" or another stat is changing unexpectedly.

Grig Gheorghiu said...

Hey Steve! Thanks for the info, it's definitely something I'll look into.