CORS Headers For Cloud Files Content Available Now

Filed in Product & Development by Megan Wohlford | December 13, 2012 11:00 am

Rackspace is pleased to announce the release of CORS (Cross Origin Resource Sharing) headers for Cloud Files[1] content. CORS headers can be used to open communication between the browser and Cloud Files.

As you may know, Cloud Files already supports the concept of Form Post[2], but when using JavaScipt, users will be burdened by the cross-site security protection that are enforced at the browser-level. However, there are many cases, like developing web applications or control panels, where the browser may need to interact with Cloud Files. To allow for this communication, users should make sure their JavaScript makes a preflight request to Cloud Files, which will send the browser a list of supported origins. If the origin of the browser is allowed, the browser can continue to make the PUTs and POSTs to Cloud Files.

Setting up CORS headers in Cloud Files is simple for API users (this feature is not yet available in our Control Panels). Using the API, set metadata on your containers for the following:

X-Container-Meta-Access-Control-Allow-Origin
This is a list of origins allowed to make cross origin requests, and should be space separated

X-Container-Access-Control-Max-Age
The length of time, in seconds, that you want the origin to hold the preflight results

X-Container-Meta-Access-Control-Allow-Headers
These are headers that you allow in the request from the browser

CORS headers should be used in conjunction with Form Post[2] and Temp URL[3].  You can get details about using this feature in our Cloud Files API Developer guide[4].

If you have additional questions, please feel free to ask them here, contact our Fanatical Support Team or email me directly at megan.wohlford@rackspace.com[5].

Endnotes:
  1. Cloud Files: http://www.rackspace.com/cloud/public/files/
  2. Form Post: http://docs.rackspace.com/files/api/v1/cf-devguide/content/FormPost-d1a555.html
  3. Temp URL: http://docs.rackspace.com/files/api/v1/cf-devguide/content/TempURL-d1a4450.html
  4. Cloud Files API Developer guide: http://docs.rackspace.com/
  5. megan.wohlford@rackspace.com: https://rackermail.rackspace.com/owa/redir.aspx?C=1Z616EcJPUOscy7LoH-DuKh5-IkVrM8IN6UEYUg6FPrEhMHOdCtwgF0JdvUWqN6D1NOAIpasOuA.&URL=mailto%3amegan.wohlford%40rackspace.com

Source URL: http://www.rackspace.com/blog/cors-headers-for-cloud-files-content-available-now/