CDN container services operations#

You can perform the operations described in the section on CDN-enabled containers in your Cloud Files account.

When you CDN-enable a container, all the objects within it become available on the CDN. Similarly, after a container is CDN-enabled, any objects added to it through the storage service become CDN-enabled. After you CDN-enable a container, its publicly-available URI can be found with the header X-Cdn-Uri, and its objects can be accessed with X-Cdn-Uri/objectName. By knowing this pattern, you can pre-generate the URI for an object before it is added to the container.

When you enable a container in the CDN service, you automatically generate URIs for SSL and streaming usage. They are listed under the X-Cdn-Ssl-Uri and X-Cdn-Streaming-Uri/X-Cdn-Ios-Uri headers.

Note: X-Cdn-Streaming-Uri and X-Cdn-Ios-Uri streaming links will be discontinued on July 31, 2022.

On August 13, 2012, the format of new CDN URIs changed in order to enhance the security of the CDN. Any URIs set in the older format (for example, http://c25810.r10.cf1.rackcdn.com/mydog.jpg) continue to work. However, any newly generated CDN URIs have the new format, as shown in the following example: http://80745c48926cd286a5a0-48261ebe0e4c795a565ece6b9cca2fe8.r10.cf1.rackcdn.com/mydog.jpg.

Note

Monitor your CDN charges. When you CDN-enable a container, not only can anyone view it, but anyone can link to it. We recommend that you monitor your bandwidth usage and charges in the Cloud Control Panel so that you know if someone is hot-linking your content. For instructions about viewing your usage charges, see Protect your Cloud Files CDN Bill from Unexpected Usage.

The examples in this section use sample values for the following:

  • account — for example, MossoCloudFS_0672d7fa-9f85-4a81-a3ab-adb66a880123

  • X-Auth-Token — for example, f064c46a782c444cb4ba4b6434288f7c

  • container — for example, MyContainer

For your own requests, you must use your own account information, authentication token, and container names. (For more information, see the authentication section.) Your authentication token and your account information are in the service catalog that is produced.

CDN-enable and CDN-disable a container#

PUT /v1/{account}/{container}

This operation enables or disables a container for use with the CDN.

Before a container can be CDN-enabled, it must exist in the storage system. To CDN-enable the container, perform a PUT request against it using the publicURL noted in the service catalog with "name": "cloudFilesCDN" during authentication, and set the X-CDN-Enabled header to True.

The Authenticate to the Rackspace Cloud section provides an example of the information in the service catalog for cloudFilesCDN.

When a container is CDN-enabled, any objects stored in it are publicly accessible over the CDN by combining the container’s CDN URI with the object name ( X-Cdn-Uri/objectName).

Note

The examples in this guide use cdn.clouddrive.com as the endpoint for operations against the CDN management service, but you should use whatever endpoints your authentication request provides. For more information about service access endpoints, see Service access endpoints.

Any CDN-accessed objects are cached in the CDN for a specified amount of time, called the Time To Live (TTL). Each time the object is accessed after the TTL expires, the CDN refetches and caches the object for the next TTL period.

You can specify the TTL for an object by including the X-Ttl: integerSeconds header. Setting the TTL is the same as setting the Expires and Cache-Control headers for the cached object. The minimum TTL is 15 minutes (900 seconds), the maximum TTL is 1 year (31536000 seconds), and the default TTL is 72 hours (259200 seconds). However, setting a TTL for a long time does not guarantee that the content stays populated on CDN edge servers for the entire period. The most popular objects stay cached based on the edge location’s logic.

A status code of 201 (Created) indicates that the container was CDN-enabled as requested. If the container is already CDN-enabled, a 202 (Accepted) status code is returned, and the TTL is adjusted. A status code of 204 (No Content) indicates that the container was CDN-enabled as requested but has no content.

To remove the container from the CDN, change the X-Cdn-Enabled header to False. However, note that objects remain on the CDN edge server and are served to the public until their TTL expires.

Note

The CDN URI is unique per container. After the container is CDN-enabled, you can make a HEAD request to the Cloud Files CDN endpoint with the container name to return the CDN URI in the X-Cdn-Uri header. You can use a cURL request similar to the following example: curl -I -H 'x-auth-token: yourAuthToken' cloudFilesCDN:yourPublicURL/yourContainerName

This table shows the possible response codes for this operation:

Response Code

Name

Description

200

OK

The request has succeeded.

202

Accepted

The request has been accepted for processing.

204

No Content

The request succeeded. The server fulfilled the request but does not need to return a body.

404

Not Found

The requested resource was not found.

Request#

This table shows the URI parameters for the request:

Name

Type

Description

{account}

String

Your unique account identifier.

{container}

String

The unique identifier of the container.

This table shows the header parameters for the request:

Name

Type

Description

X-Ttl

Int

Specifies the Time To Live (TTL) in seconds for an object to be cached in the CDN. The default value is 259200 seconds, or 72 hours. The minimum TTL is 15 minutes (or 900 seconds), and the maximum is 1 year (31536000 seconds).

X-Cdn-Enabled

String

Indicates if a container is CDN-enabled. Valid values are True and False.

This operation does not accept a request body.

Example: CDN-enable container HTTP request

PUT /v1/MossoCloudFS_0672d7fa-9f85-4a81-a3ab-adb66a880123/MyContainer HTTP/
1.1
Host: cdn.clouddrive.com
X-Auth-Token: f064c46a782c444cb4ba4b6434288f7c
X-Ttl: 259200
X-Cdn-Enabled: True

Example: CDN-disable container HTTP request

POST /v1/MossoCloudFS_0672d7fa-9f85-4a81-a3ab-adb66a880123/MyContainer HTTP/1.1
Host: cdn.clouddrive.com
X-Auth-Token: f064c46a782c444cb4ba4b6434288f7c
X-CDN-Enabled: False

Response#

This table shows the header parameters for the response:

Name

Type

Description

Content-Length

String

If the operation succeeds, this value is zero (0). If the operation fails, this value is the length of the error text in the response body.

Content-Type

String

The MIME type of the list of names. If the operation fails, this value is the MIME type of the error text in the response body.

Date

Datetime

The transaction date and time.

X-Cdn-Ios-Uri

String

The URI for video streaming that uses HTTP Live Streaming from Apple. To be discontinued July 31, 2022

X-Cdn-Ssl-Uri

String

The URI for downloading the object over HTTPS, using SSL. (The user cannot have custom SSL certificates because the Rackspace CDN partner does not provide that feature.)

X-Cdn-Streaming-Uri

String

The URI for video streaming that uses HTTP Dynamic Streaming from Adobe. To be discontinued July 31, 2022

X-Cdn-Uri

String

Indicates the URI that you can combine with object names to serve objects through the CDN.

X-Trans-Id

Uuid

A unique transaction identifier for this request.

This operation does not return a response body.

Example: CDN-enable container HTTP response

Note: X-Cdn-Streaming-Uri and X-Cdn-Ios-Uri links will be discontinued on July 31, 2022.

HTTP/1.1 204 No Content
Content-Length: 0
Content-Type →text/html; charset=UTF-8
Date →Wed, 17 Dec 2014 19:58:49 GMT
X-Cdn-Ios-Uri →http://acc3b9ba6a79805f5577-e7e60117100ffd73b45850c0b1fd96c1.iosr.cf5.rackcdn.com
X-Cdn-Ssl-Uri: https://83c49b9a2f7ad18250b3-346eb45fd42c58ca13011d659bfc1ac1. ssl.cf0.rackcdn.com
X-Cdn-Streaming-Uri: http://084cc2790632ccee0a12-346eb45fd42c58ca13011d659bfc1ac1. r49.stream.cf0.rackcdn.com
X-Cdn-Uri: http://081e40d3ee1cec5f77bf-346eb45fd42c58ca13011d659bfc1ac1.r49.cf0.rackcdn.com
X-Trans-Id: tx82a6752e00424edb9c46fa2573132e2c

List metadata for CDN-enabled container#

HEAD /v1/{account}/{container}

This operation gets a CDN-enabled container’s metadata.

You can view CDN-enabled container details by performing a HEAD operation on a container where the Host header value is one of the cdnCloudFiles service access endpoints. (For the CDN endpoints, see Service access endpoints.)

Note

Remember that your HEAD operation must be on the CDN host (for example, cdn.clouddrive.com). Otherwise, you will see the metadata for your private container as described in Get account metadata.

A 204 (No Content) HTTP status code is returned if the account has no containers. Otherwise, the status code of 200 (OK) is returned. Status code 404 (Not Found) is returned if the requested container was not found.

This table shows the possible response codes for this operation:

Response Code

Name

Description

200

OK

The request has succeeded.

204

No Content

The request succeeded. The server fulfilled the request but does not need to return a body.

404

Not Found

The requested resource was not found.

Request#

This table shows the URI parameters for the request:

Name

Type

Description

{account}

String

Your unique account identifier.

{container}

String

The unique identifier of the container.

This operation does not accept a request body.

Example: List metadata for CDN-enabled container HTTP request

HEAD /v1/MossoCloudFS_0672d7fa-9f85-4a81-a3ab-adb66a880123/MyContainer HTTP/1.1
Host: cdn.clouddrive.com
X-Auth-Token: f064c46a782c444cb4ba4b6434288f7c

Response#

This table shows the header parameters for the response:

Name

Type

Description

X-Cdn-Uri

String

The URI for downloading the object over HTTP. This URI can be combined with any object name within the container to form the publicly accessible URI for that object for distribution over a CDN system.

X-Ttl

Int

The TTL value in seconds. The default value is 259200 seconds, or 72 hours. The minimum TTL is 15 minutes (or 900 seconds), and the maximum is 1 year (31536000 seconds).

X-Cdn-Enabled

Boolean

True or False to indicate whether the container is currently marked to allow public serving of objects through the CDN.

X-Log-Retention

Boolean

True or False to indicate whether the CDN access logs should be collected and stored in the Cloud Files storage system.

X-Cdn-Ssl-Uri

String

The URI for downloading the object over HTTPS, using SSL. (The user cannot have custom SSL certificates because the Rackspace CDN partner does not provide that feature.

X-Cdn-Streaming-Uri

String

The URI for video streaming that uses HTTP Dynamic Streaming from Adobe. To be discontinued July 31, 2022

X-Cdn-Ios-Uri

String

The URI for video streaming that uses HTTP Live Streaming from Apple. To be discontinued July 31, 2022

This operation does not return a response body.

Example: Get CDN-enabled container metadata HTTP response

Note: X-Cdn-Streaming-Uri and X-Cdn-Ios-Uri links will be discontinued on July 31, 2022.

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-346eb45fd42c58ca13011d
 659bfc1ac1.r49.stream.cf0.rackcdn.com
X-Trans-Id: tx82a6752e00424edb9c46fa2573132e2c
Content-Length: 0

Update CDN-enabled container metadata#

POST /v1/{account}/{container}

This operation updates the CDN-enabled container’s metadata.

A POST operation against a CDN-enabled container adjusts the following metadata:

  • X-Log-Retention

  • X-Cdn-Enabled

  • X-Ttl

A status code of 204 (No Content) indicates success. Status code 404 (Not Found) is returned if the requested container is not found.

This table shows the possible response codes for this operation:

Response Code

Name

Description

204

No Content

The server fulfilled the request but does not need to return a body.

404

Not Found

The requested resource was not found.

Request#

This table shows the URI parameters for the request:

Name

Type

Description

{account}

String

Your unique account identifier.

{container}

String

The unique identifier of the container.

This table shows the header parameters for the request:

Name

Type

Description

X-Log-Retention

Boolean

True or False to indicate whether the CDN access logs should be collected and stored in the Cloud Files storage system.

X-Cdn-Enabled

Boolean

True or False to enable or disable public sharing over the CDN. If you have content currently cached in the CDN, setting your container back to private does not purge the CDN cache. You have to wait for the TTL to expire or purge the objects.

X-Ttl

Int

The TTL value in seconds. The default value is 259200 seconds, or 72 hours. The minimum TTL is 15 minutes (or 900 seconds), and the maximum is 1 year (31536000 seconds).

This operation does not accept a request body.

Example: Update CDN-enabled container metadata HTTP request

POST /v1/MossoCloudFS_0672d7fa-9f85-4a81-a3ab-adb66a880123/MyContainer HTTP/1.1
Host: cdn.clouddrive.com
X-Auth-Token: f064c46a782c444cb4ba4b6434288f7c
X-Ttl: 86400
X-Cdn-Enabled: True
X-Log-Retention: True

Response#

This operation does not return a response body.

Example: Update CDN-enabled container metadata HTTP response

Note: X-Cdn-Streaming-Uri and X-Cdn-Ios-Uri links will be discontinued on July 31, 2022.

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