Tuesday, January 16, 2018

cdn - How does "Cloud Files" from Rackspace know about my CNAME record?

TLDR: when I make this DNS record:



whatever.mydomain.com.  IN CNAME biglongjibberstring.r89.cf2.rackcdn.com.



How does Rackspace know that this random host name I've chosen should go to my Cloud Files container/account as opposed to another customer?






I just tested a simple example of using Cloud Files with Rackspace. I made a Cloud Files "Container" and enabled the "Static Website" option. I uploaded an example image and an example index.html file. These files in this container are now available at this crazy-long URL, which the UI tells me I can use as the CNAME for my domain:



Cloud Files container settings



And sure enough, adding a CNAME record like:




whatever.mydomain.com. IN CNAME biglongjibberstring.r89.cf2.rackcdn.com.



Browsing to http://whatever.mydomain.com/ works (tested the home page and the image). But how could it possibly know that when it sees a request for "whatever.mydomain.com" (in the HTTP Host header) that it is meant for my particular cloud files container?



It seems to have something to do with DNS, since if I just put "blah.example.com" in my hosts file with the IP address that biglongjibberstring.r89.cf2.rackcdn.com. resolves to - that does not work (gives an error about Invalid URL - appears to be coming from Akamai). The only way I could possibly see this working is if somehow the DNS lookup for whatever.mydomain.com was somehow transmitting back to Rackspace/Akamai DNS servers this relationship between "whatever.mydomain.com" and "biglongjibberstring.r89.cf2.rackcdn.com.". But I've never seen this approach and I don't even think that DNS lookup that goes back to Rackspace/Akamai actually contains the information necessary for this (although I could be wrong about that).



Does anyone know what kind of black magic is going on here?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...