Staging with ChinaCDN

Staging with ChinaCDN

If you want to test on Akamai staging network you normally lookup the IP address of the staging CNAME. 
For eg: 

nslookup mycompany.edgekey-staging.net

mycompany.edgekey.netcanonical name = e5663.dsce2.akamaiedge.net.

Name:e5663.dsce2.akamaiedge.net

Address: 104.121.161.26

If you curl for this or spoof your hostfile you will see the staging header 

X-Akamai-Staging: ESSL

But things are different if you use ChinaCDN. As Akamai has to decide on DNS level if a request is/is-not sent from China there is a DNS traffic manager added to the DNS resolving process, so the lookup will lokk like this 

nslookup mycompany.edgekey-staging.net

mycompany.edgekey.net canonical name = mycompany.edgekey.net.globalredir.akadns.net.

lmycompany.edgekey.net.globalredir.akadns.net canonical name = e2929.g.akamaiedge.net.

Name:e2929.g.akamaiedge.net

Address: 184.85.245.249

The \*.globalredir.akadns.net. will always guide you to the same IP, no matter if you add -staging or not.

The solution is to step behind the global redirector, using the numbered edgenode itself.

So, in our case, the requests resolves to 
e2929.g.akamaiedge.net

we would then lookup e2929.g.akamaiedge-staging.net
and get the IP 

23.200.251.8
this can be used to spoof your hostfile. 
In general, if you do not see the header 

X-Akamai-Staging: ESSL
in your response you know you are not on the staging network.