This guide shows how to set CORS Header in Rackspace Cloud Files to Allow or Restrict usage over HTTPS protocol and how to get the headers. We talked about CORS in a previously published article. We can set CORS Header in Rackspace Cloud Files on individual files as well as container (quite difficult method) and purge the file, cURL to check the headers.
CORS Header in Rackspace Cloud Files : Importance and Official Documentation
Setting the right CORS Header in Rackspace Cloud Files is important with HSTS, SPDY enabled fronted, else the modern browsers might block loading things based on server configuration, like we can set CORS rules on Nginx. You can test CORS with latest Chrome browser’s console tool against your webpage, to check whether anything is getting blocked. Official documentations are available here :
CORS Header in Rackspace Cloud Files : Methods
We can set CORS from Rackspace Cloud account by going to the container and clicking on the file and selecting a value and hitting the Return / Enter key. By default, origin will be set to
https://mycloud.rackspace.com, we need to delete the value and add our own domain as origin. You must purge the file (if you have set a higher value of max age like 50 yrs like me :p ). You can
curl to get the headers :
curl -I https://5bf5085ff6a0ff8a98e0-fbacee3e259cb36f1f312cedca614c38.ssl.cf2.rackcdn.com/icon-font.css
HTTP/1.1 200 OK
Last-Modified: Mon, 29 Sep 2014 21:39:20 GMT
Cache-Control: public, max-age=25920000
Expires: Mon, 27 Jul 2015 09:30:56 GMT
Date: Tue, 30 Sep 2014 09:30:56 GMT
You should set CORS on NGINX as separate blocks to allow various origin like specifically for
5bf5085ff6a0ff8a98e0-fbacee3e259cb36f1f312cedca614c38.ssl.cf2.rackcdn.com in the above example. Multiple domain name CORS block is accept unless there is any contradiction. Google Ads add the CORS from account settings, thats why we never need to add Google specific CORS. But,
YouTube cookie domain must be allowed, you should periodically check on Chrome on random pages to catch any blocked material.
Cyberduck is a nice tool, read it :
We can set CORS on a container to inherit the properties by
POST method. You can see the discussion here :
and use our great CocoaRestfulClient to do anything!