Get the public URL of a recently uploaded CloudFiles resource

When uploading a new asset to CloudFiles storage, I want to get the public URL of that asset (if the container is CDN enabled). I figured out that the only way to do this is to issue 3 (yes, three!) Requests to RackSpace:

  • Authenticate the user and get x-auth-token

    , x-storage-url

    and x-cdn-management-url

    .
  • After getting all tokens and urls, upload the file to the container.
  • Make a HEAD request for the x-cdn-management-url

    container public url.

I just want to make sure that I actually need 3 download requests to get the public url of the asset I just downloaded. All operations must be performed programmatically through the API.

+3


source to share


2 answers


I believe that after you have the url of the CDN container, every object you add to it is added to it. So, if your CDN is a container cdn1.foo.cloudstorage.com

, your objects will have URLs cdn1.foo.cloudstorage.com/object1.ext

, cdn1.foo.cloudstorage.com/object2.ext

etc.



You only need three steps to get the original url of the CDN container. Subsequently, it's easy.

+4


source


If you are using Java, PHP or Python, check out one of the Rackspace SDKs . Examples of using CDNs with each of them:



+1


source







All Articles