Atom feed of this document
 
 
 

 5.2.1. CDN-Enable a Container

Before a container can be CDN-enabled, it must exist in the storage system. To CDN-enable the container, PUT it to the publicURL created under Cloud Files during Authentication and set the X-CDN-Enabled header to TRUE. (In the examples below, the publicURL used is cdn.clouddrive.com.) When a container is CDN-enabled, any objects stored in it are publicly accessible over the Content Delivery Network by combining the container's CDN URL with the object name (X-CDN-URI/objectName).

Any CDN-accessed objects are cached in the CDN for the specified amount of time called the TTL, or Time to Live. The default TTL value is 259200 seconds, or 72 hours. Each time the object is accessed after the TTL expires, the CDN refetches and caches the object for the TTL period.

You specify the TTL for an object by including the HTTP header X-TTL: <integer_seconds>. Setting the TTL is the same as setting the HTTP Expires and Cache-Control headers for the cached object. The minimum TTL is 15 minutes (900 seconds) and the maximum is 50 years for a range of 900 to 1576800000 seconds. Setting a TTL for a long time, however, does not guarantee that the content will stay populated on CDN edge servers for the entire period. The most popular objects stay cached based on the edge location's logic.

[Note]Note

On August 13, 2012, the maximum TTL was set to 31536000 (one year). If you set new TTL values to a greater time frame, your object will still expire at the one-year mark. However, if you already had a greater TTL value set on an object, it will expire at the time you had originally set.

 

Example 5.9. Container CDN-Enable Request

  PUT /<api version>/<account>/<container> HTTP/1.1
  Host: cdn.clouddrive.com
  X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
  X-TTL: 2592000
  X-CDN-Enabled: True
                    

No content is returned. A status code of 201 (Created) indicates that the container was CDN-enabled as requested. The response will contain an HTTP header to indicate the URL that can be combined with object names to serve objects through the CDN. If the container is already CDN-enabled, a 202 (Accepted) response is returned and the TTL is adjusted.

 

Example 5.10. Container CDN-Enable Response

  HTTP/1.1 204 No Content
  X-Cdn-Ssl-Uri: https://83c49b9a2f7ad18250b3-346eb45fd42c58ca13011d659bfc1ac1. ssl.cf0.rackcdn.com
  X-Ttl: 259200
  X-Cdn-Uri: http://081e40d3ee1cec5f77bf-346eb45fd42c58ca13011d659bfc1ac1. r49.cf0.rackcdn.com
  X-Cdn-Enabled: True
  X-Log-Retention: False
  X-Cdn-Streaming-Uri: http://084cc2790632ccee0a12-346eb45fd42c58ca13011d659bfc1ac1. r49.stream.cf0.rackcdn.com
  X-Trans-Id: tx82a6752e00424edb9c46fa2573132e2c
  Content-Length: 0
                      

In order to remove the container from the CDN, change the X-CDN-Enabled flag to False, as in the request below. Please note, however, that objects remain public until their TTL expires.

 

Example 5.11. Container CDN-Disable Request

  PUT /<api version>/<account>/<container> HTTP/1.1
  Host: cdn.clouddrive.com
  X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
  X-TTL: 2592000
  X-CDN-Enabled: False
                    



loading table of contents...