SimpleCDN CNAME Confusion
I am using SimpleCDN to serve some static scripts and images of WordPress on my website.
Not like AWS CloudFront, Amazon’s CDN service, which only allows expiration date carried from S3 file meta. SimpleCDN supports fine tuning Expiration, P3P and gzip encoding through something called Pre-URL. Which look like these
http://s.mudy.info.simplecdn.net/
http://s.mudy.info-s1.simplecdn.net/
http://s.mudy.info-e7.simplecdn.net/
Here ‘-s1′ means special 1 with expire and gzip; ‘-e7′ means 10 years expire without gzip. And a lot more with different combo effects.
SimpleCDN also supports CNAME to any of these urls. Because there is not a lot document on how to use simplecdn. I mistakenly CNAMEed ’s.mudy.info’ to the first URL
s.mudy.info.simplecdn.net
Run my website through Yslow, I got a lot F score due to lack of expire headers and non-gzip on static files. I realize I have to use these different Pre-URLs in order to get http headers, so I substitute ’s.mudy.info’ in WordPress with ’s.mudy.info-s1.simplecdn.net’ or ’s.mudy.info-e7.simplecdn.net’. Originally very simple urls’ become long and urgly.
Due to some DNS setting error, I accidentally pinged 2 different SimpleCDN pre-urls. The results are 2 different IPs. I reallized I made another mistake today, these pre-urls are supposed to be used as CNAME to get different http headers and gzip encoding, because these hostname all has their own IPs. A quick testing I CNAME ’s.mudy.info’ to
s.mudy.info-s1.simplecdn.net
which gives nicely gzipped files with correct expiration settings.
This design is what I initially did not expect. Because traditional CDN usually use HTTP hostname to distinguish objects, so I normally would think I have to use different hostnames. However SimpleCDN use anycast , so they use same IP block on on all edge servers, which make it possible to use different IP addresses to distinguish requests.