KeyCDN icon


Visit site

Simple, fast, and reliable, KeyCDN focuses on high performance to satisfy your needs.

About KeyCDN

KeyCDN is a powerful and easy to use Content Delivery Network (CDN) crafted from the ground up with focus on high performance. A simple, fast, and reliable CDN, KeyCDN is made to satisfy your needs — you can speed up your games, software delivery, advertisements, CMS, websites, and more. Offering a real-time content delivery network, KeyCDN is HTTP/2 ready and built for the future.

Offering simplified content delivery, KeyCDN can supercharge your website to provide an exceptional user experience. You maintain full control over your assets with easy pay-as-you-go pricing, a powerful management dashboard, and RESTful API. Reliable and secure, KeyCDN requests are routed to the nearest available POP, while providing industry-leading encryption standards and two-factor auth. The KeyCDN focus on high performance includes a customized TCP stack, a highly optimized IP Anycast and geolocation routing.

Integrating DigitalOcean Spaces With KeyCDN


As more websites are built to rely on object storage solutions for storing static assets, developers are on the lookout for different ways they can improve website performance and load times. Accelerating web assets to boost delivery speed can enhance a user’s overall experience. One increasingly common way to do this is by implementing a content delivery network or CDN. A CDN is a distributed set of servers which cache and deliver web assets to users from an edge server close to their geographic location, improving the speed and availability of the website.

In this guide, we will go over how to set up a CDN with KeyCDN, a content delivery network provider. We will then configure the CDN to serve files from a remote object store, in this case DigitalOcean Spaces.


In order to complete this tutorial, you will need to set up a DigitalOcean Space. This can be configured using the Introduction to DigitalOcean Spaces guide. When creating your Space, be sure that you check the box next to “Enable File Listing”:

Ensure Enable File Listing is checked

Creating the CDN

KeyCDN is a content delivery network provider that was designed to integrate with a number of CMSs (content management systems) and frameworks. In addition to a paid service, KeyCDN offers a free 30-day trial, which you can use to try out this tutorial. Accordingly, the first step to creating a CDN with KeyCDN is to sign up and register with the service.

From your browser, navigate to and click the SIGN UP button at the top-right. After entering in your website and email address and choosing a username and password, a verification link will be sent to the email address you provided. Click that link, and you will be taken to the KeyCDN user interface.

KeyCDN user interface

Navigate to the Zones page in the left-hand menu and click on Add Zone. From here, add the following information:

  • Zone Name: In this field, enter the name you’d like to give for your CDN Zone. The name can be anything you’d like as long as it consists only of alphanumeric characters, although it may be helpful to give it a descriptive name. In our example we’ve called the Zone “dospaces.”
  • Zone Status: Make sure that this option is set to active.
  • Zone Type: Ensure that this is set to Pull. When a Pull CDN receives a request, it automatically “pulls” files from a server or storage location and then serves them to the site’s visitors. It then caches the file so it can be accessed more quickly later on. With a Push CDN, however, the website owner must upload (or “push”) files to the CDN and then add links to that content on their site. Pull CDNs are generally seen to be easier to manage, while Push CDNs are recommended for sites that serve large files like videos.
  • Origin URL: Here, add your Space’s URL. This can be copied directly from the DigitalOcean Spaces Control Panel. Be sure to include the “https://” part of the URL.

After adding those details, the page will look like this:

Create a KeyCDN pull zone

Next, click the green Save button at the bottom of the page to save and deploy the CDN.

Once your CDN is deployed, it is ready to be configured to serve the static assets stored on your Space. It’s best practice, however, to first test that it is indeed up and running before diving into configuration tasks. In the next step of this tutorial, we will test whether the CDN is functioning properly.

Testing the CDN

If you added all your information correctly, you should now be able to access your Spaces files using the Zone URL along with the path for a specific file. You can test that the CDN is functioning as expected by submitting a cURL request for a file from your Space served through the CDN.

Open up a terminal and run the following curl command. Be sure to replace dospaces-1c6b with the first part of the Zone URL provided by KeyCDN (which can be found on the Zones page of your KeyCDN account) and replace path/to/your/asset.css with the file path of the asset stored on your Space.

  1. curl -I
HTTP/1.1 200 OK Server: keycdn-engine Date: Fri, 30 Mar 2018 13:19:53 GMT Content-Type: image/jpeg Content-Length: 48316 Connection: keep-alive Last-Modified: Thu, 29 Mar 2018 17:38:15 GMT ETag: "5f990c905768d4cdc040cf23c25cbef7" x-amz-request-id: tx00000000000000005309f-005abe38fe-17253a-nyc3a Strict-Transport-Security: max-age=15552000; includeSubDomains; preload Expires: Fri, 06 Apr 2018 13:19:53 GMT Cache-Control: max-age=604800 Link: <>; rel="canonical" X-Cache: HIT X-Edge-Location: uswd Access-Control-Allow-Origin: * Accept-Ranges: bytes

The line HTTP/1.1 200 OK at the top of the file indicates that the request was returned successfully, while the X-Cache: HIT line near the bottom indicates that the CDN is serving the file from cache.

Note that the X-Cache status may also return as MISS. If this is the case, it may mean that your CDN is not caching the file properly, or it could just be that it did not serve the file from cache on that particular request. Try again a few more times; if it returns HIT then the CDN is caching the file properly, but if it consistently returns MISS then you may need to double check that you added your information correctly to the KeyCDN user interface in the previous step.

Once you can see HTTP/1.1 200 OK and X-Cache: HIT in the cURL command’s output, then you have verified that your CDN is properly serving and caching your assets.


Utilizing a CDN has a number of benefits beyond just speed improvements. A CDN adds a level of redundancy to your site’s content without the need for additional hardware, which helps to ensure the availability of your assets. Also, because a CDN distributes assets from a larger number of servers, it can also make a website more scalable and resistant to surges in traffic.

There are a number of things you could do from here to further customize your CDN and boost your website’s performance. For example, you could integrate it with your website’s CMS or set up a CNAME DNS record to create an alias for the Zone URL provided by KeyCDN.

KeyCDN Logo

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I’m currently using DO Spaces and I’m very interested in connect this with KeyCDN. I have configured the integration following this tutorial and works very well.

However the main problem is that File Listing option on Storage is needed to works with the external CDN.

How can avoid file listing and use an external CDN at the same time? It’s very important that files cannot be listed…

Publish your Tool on Community

Have you created an Integration, API Wrapper, Service, or other Tool that helps developers build on DigitalOcean? Help users find it by listing it in Community Tools.

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel