0

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?

  • It's not black magic. It's protocol. Read: tools.ietf.org/html/rfc7230#section-5.4 – Michael Hampton May 15 '15 at 2:44
  • Right, but if the Host header contains "whatever.mydomain.com" and I've never typed this into my Rackspace Cloud Files control panel - how does it know that when it sees a request for "whatever.mydomain.com" it should go to my account and not someone else's? – bgp May 15 '15 at 2:45
1

After observing the behavior, my best guess at what they could reasonably be doing is this:

When an HTTP request arrives at one of the CDN nodes and the request has an unknown Host header they themselves look up the name in the Host header.

If this name turns out to be a CNAME referring to a known name (on the form <identifyinginformation>.rackcdn.com.) they associate the name from the Host header with the appropriate resource, otherwise they return an error.


This is speculative but that's what I can think of that fits what is technically viable as well as the observed behavior. The documentation at Rackspace does not specify how it actually works, but hopefully their support could help.

If anyone wants to experiment further on their own a Rackspace employee mentions the URL http://124f4d373d9886355285-0dddf6f52a326dca397d3ae1202a22fd.r49.cf2.rackcdn.com/1_logs_dir.png as an example in the comments at the documentation page linked above. Just add a CNAME to the host part of that URL, modify the URL accordingly and try it out.

  • I agree - I see no other way it would be workable. – bgp May 15 '15 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.