I am using Spaces S3 storage on DigitalOcean. To add a subdomain for my Spaces, an SSL certificate is required to be uploaded. I am trying to use the Cloudflare Free Edge SSL certificate, and forward my requests from my subdomain.company.com to Spaces Endpoint.
I've figured it out, this is how it works for me.
- Create a DigitalOcean Space with the CDN option selected. The space name must match the fully-qualified subdomain you want to use, e.g.
cdn.example.com
if you were using that domain. - Create the desired CNAME for your DO CDN on Cloudflare. For the CNAME record value use the CDN endpoint value provided by DO. Keep the "proxied" toggle on.
- Use Cloudflare Dashboard to create origin server self-signed SSL Cert specifically for the CNAME (Custom domain) created in step 2.
- Use DO Spaces CDN option to add a new subdomain SSL certificate created from Step 3. Add Name, Cert, Key, and your Custom Domain value and Save.
- Done! Cloudflare is now proxying your DO CDN domain, and your files on DO Spaces can be served on a Custom Domain.
I was still running into issues with Manoj's solution. Eventually I was able to resolve it. The problem was that the space name must match the custom subdomain exactly, e.g.:
cdn.example.com
Another way to do it:
Create a DigitalOcean Space.
Create a Cloudflare SSL > Origin Server certificate.
Your hostname should point to your custom subdomain exactly.
ex: cdn.example.com
. Save certificate and key.Enable CDN on your DigitalOcean Space and add subdomain.
Enter recently created ssl certificate and key. Once you add this you should be able to select
ex: cdn.example.com
from the custom subdomain select box.Create a Cloudflare DNS > CNAME record.
Use desired CNAME for your DigitalOcean CDN on Cloudflare
ex: cdn
. For the CNAME record value use the CDN endpoint value provided by DigitalOcean. Keep the "proxied" toggle on.
© 2022 - 2025 — McMap. All rights reserved.