How to Fix Rackspace File Cloud Leverage Browser Caching via API & SSH

Rackspace for quite some time have failed to add the option that allows users to change the caching expire rates (TTL / Level Browser Caching) within the control panel despite other vendors offering this feature and constant requests by their users. The normal response from the Rackspace team is normally “you can setup a TTL expire of up to via 72 hours (3days) or if you require more you can use the API and change it up to 50 years”.

The interesting thing is that containers set a default TTL of 72 hours within the Rackspace control panel, however when doing speed checks on sites like it displays our site having a leverage browsing caching of 15mins, upon further investigates we found that the main site of also had a 15mins expire rate on their file cloud which makes us believe that the default leverage browsing caching is actually 15mins.

Contacting Rackspace Support

We contacted the Rackspace Support Team 3 days ago and it took many follow ups on our live chats and tickets to resolve the issue of our leverage browsing cache. The Rackspace Techie Team has multiple tiers for their support as you would imagine from any good webhosting company. If the first tier can’t resolve the problem it’s escalated to a 2nd tier team, Sadly we found both teams overuse the word API, What does API mean exactly well it means application programming interface but to the average Joe and small business it means absolutely nothing apart from the fact we know it can be used in more ways than one, without a client to tap into the API it can’t be used, maybe they assume that you’re going to code your own application but that takes time and money, and for most small businesses isn’t an option.

Most businesses and sites do not start as big as CNN type sites with millions of visitors per an hour, the whole point of Clouds is their ability to scale with demand, this would mean that a small business could scale into a big company, the forcing use of API really does over complicate things for the average small business, they really should simplify things and enable these options within their control panels, this way they cater for all companies while allowing them to use the API should they need it at an later date.

Looking though the documentation offered on Rackspace site and even talking to the staff they don’t discuss practical use of the API in terms what applications can be used, they trend lightly on Cyberduck which is a great help for anyone wanting to make folders within their containers since their control panel lacks this (another big limitation) but setting things like leverage browser caching is really limited in terms of documentation and the first tier techies don’t know much in regards of the API either.

Using SSH

We at ByBe at big fans of Ubuntu since it’s easy and well catered for smaller businesses so all our examples here will be done in Ubuntu if are running something other than Ubuntu then you are most likely to have the knowledge to adjust the commands slightly.

Installing Curl

First of your going to need to install CURL to your Ubuntu server, this will allow you to access the API via SSH. If you’re not using a Linux based server offered by Rackspace or any other company, simply visit Ubuntu and either install it using VMware or download their windows version and run it alongside your current setup.

To install curl simply run:

sudo apt-get install curl

Talking to the Rackspace File Cloud API

To talk to the API offered by the File Cloud you’re going to need to authenticate yourself, you will need your API Key. If you haven’t already got your API key you need to generate one or if you have already you need to copy and paste it into a command in a moment, I recommend loading up a text document and copying it in their as this will make it a lot easier adjusting the code to suit your needs.

Your API Key can be created or found here (Home > Your Account > API Access):

Rackspace API Key

Once you know your API Key, you can start talking to their API System, To authenticate yourself do the following command:

curl -i -H "X-Auth-User: YOUR-USERNAME-HERE" -H "X-Auth-Key: YOUR-KEY-HERE"

In the event you are using the US based file cloud then you will need to change the last URL address from the UK to the US server which is ""

Once you typed that command you should be greeted with some text like so:

HTTP/1.1 204 No Content
Server: Apache/2.2.13 (Red Hat)
vary: X-Auth-Token,X-Auth-Key,X-Storage-User,X-Storage-Pass
Cache-Control: s-maxage=42072
Content-Type: text/xml
Date: Mon, 12 Mar 2012 04:35:28 GMT
X-Auth-Token: 00x0x0xx-xx00-00xx-x000-xx0000xx00x0
X-Storage-Token: 00x0x0xx-xx00-00xx-x000-xx0000xx00x0
Connection: Keep-Alive
Content-Length: 0

The important values here are the X-Auth-Token and X-CDN-Management-URL, copy these into a document so that you can use these later.

Increasing your TTL / Expires with the Rackspace API and SSH

Now that you have CURL installed as well as the noted down Auth-Token and CDN management URL it’s time we set your expires to something more desirable than 15mins or 72 hours.

You first need to know how long you want your TTL Expires to be, Rackspace works in seconds with the expire so if for example if you want to 2 weeks then you will need to know what this equals to in seconds.

We recommend Google for finding out the seconds in hours days or even weeks, doing a simple search in Google such as “2 weeks to seconds” will display this:

Google Weeks to Days for Rackspace

The command to set the TTL Expire

Here is the commands you need to set the TTL expire:



TTL 2 Weeks: 1209600
X-Auth-Token: 00x0x0xx-xx00-00xx-x000-xx0000xx00x0
X-CDN-MANAGEMENT-URL: Your Container: images2012

With the above details the command would look like:

curl -XPUT -H x-ttl: 1209600 -H x-auth-token:

Remember to use the X-AUTH-TOKEN Key, and not the actually API Key, you should get no errors at this point and the caching should be fixed for you.

Checking your containers for the new TTL Expires

To check your containers to see if they took the new TTL’s ok, simply run this command.

curl -I -H x-auth-token:YOUR-TOKEN-KEY-NOT-AUTH-KEY

Hopefully it will display your new TTL's Expires fixing the levelage browsing cache issue on speed testing sites

Must Mention

Despite some the problems on their network at present and limitations within their control panels, Rackspace offer excellent customer it is for this reason we recommend them to all our customers and the reason we stick with them ourselves, we have been with many providers over the years and they are the best we have encountered.

If you have any problems then please use the comments below, we will try to reply as soon as we are able too.

E-Commerce Designs


Social Bookmarks

Twitter Facebook RSS-Feed

Contact us

ByBe Web Design Bournemouth
35 Knyveton Road
Tel:01202 949749