How to Enable the Spaces CDN

Spaces Object Storage is an S3-compatible object storage service. Spaces buckets let you store and serve large amounts of data, and the built-in CDN minimizes page load times and improves performance.


Spaces provides a built-in content delivery network (CDN), which is a network of edge servers that deliver content to users. Each point of presence (PoP), the location of a group of edge servers, sends content to the users that are physically closest to it. CDNs help deliver static and dynamic online content faster and more reliably, and provides a layer of redundancy for websites. The Spaces CDN is subject to the same transfer charges as Spaces.

You can enable the Spaces CDN either when creating a new Space or on an existing Spaces bucket’s Settings tab, in the CDN (Content Delivery Network) section.

Once you’ve enabled the Spaces CDN for a bucket, you can access the contents of that bucket using the edge URL <spacename>.<region>.cdn.digitaloceanspaces.com in addition to the existing origin URL. You can also customize the CDN endpoint with a secure subdomain you own. This lets you use a URL like images.example.com in addition to <spacename>.<region>.cdn.digitaloceanspaces.com.

You can also use presigned URLs with the Spaces CDN. To do so, configure your SDK or S3 tool to use the non-CDN endpoint, generate a presigned URL for a GetObject request, then modify the hostname in the URL to be the CDN hostname (<space-name>.<region>.cdn.digitaloceanspaces.com, unless the bucket uses a custom hostname).

Warning
We do not recommend or support using multiple CDNs from separate vendors with your Spaces buckets (such as the Spaces built-in CDN and another vendor’s CDN), as it can cause performance issues and be complex to manage.

Enable the CDN During Bucket Creation

To enable the CDN when creating a new bucket, on the Spaces create page, look for the CDN (Content Delivery Network) section.

The CDN section of the Spaces create page

Click Enable CDN. An Edge Cache TTL drop-down menu will appear. This setting determines the amount of time that the content is cached. You can keep the default of 1 hour or choose another value. You can also customize the CDN endpoint with a secure subdomain you own.

Finish choosing the rest of the settings for the bucket, then click Create a Space. Once the bucket is created, you can modify the edge cache TTL setting and custom subdomain at any time on the bucket’s Settings page.

Enable the CDN for an Existing Bucket

From the control panel, navigate to the bucket’s detail page by clicking the name of the bucket. From there, click on the Settings tab. The text in the CDN (Content Delivery Network) section will tell you if the CDN is currently Enabled or Disabled for the bucket.

To enable the CDN, in the same CDN (Content Delivery Network) section, click Edit. In the options that open, click Enable CDN. When you do, several options for the CDN will appear.

The Settings tab for a bucket with CDN settings opened

You can customize the CDN endpoint with a secure subdomain you own using the Use a custom subdomain menu. The Edge Cache TTL determines the amount of time that the content is cached. You can keep the default of 1 hour or choose another value.

When you’re done choosing options, click Save. Once the CDN is enabled, you can return to this page to modify the edge cache TTL setting and custom subdomain.

Disable the CDN

From the control panel, navigate to that bucket’s detail page by clicking the name of the bucket. From there, click on the Settings tab. The text in the CDN (Content Delivery Network) section will tell you if the CDN is currently Enabled or Disabled for the bucket.

To disable the CDN for an existing bucket from the control panel, navigate to that bucket’s detail page by clicking the name of the bucket. From there, click on the Settings tab.

In the CDN (Content Delivery Network) section, click Edit. In the options that open, click Disable CDN and then Save.

Click Confirm to disable the CDN, which removes all files and certificates from the edge servers, and all CDN and edge server endpoints.