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 headers.

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.

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.

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.

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(NoContent) 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.

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.

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(NoContent) HTTP status code is returned if the account has no
containers. Otherwise, the status code of 200(OK) is returned. Status code
404(NotFound) 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.

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).