Digital Ocean CDN Spaces compatibility



Hi CF community - we would like to move to Digital Ocean’s new CDN, Spaces.

Does anyone know if Spaces is compatible with Cloudflare especially with caching files on Cloudflare’s edge network?

Thanks in advance


Hi there. I think there may be some confusion - DO Spaces is just object storage not CDN. Additionally, if you wanted to utilize a CDN for assets stored in a DO Space, you would need to go with a pull-zone type CDN.

I’m not sure if you’re already using DO Spaces, but I have a trial going and it’s very similar to S3/Google buckets in the sense that your assets are given a unique URL such as https://<bucket-name><asset-name>. Since these assets are on an external domain there’s no way Cloudflare would be able to cache them.


@andy can you CNAME to the DO Spaces instance or does it look for the host header in the web request? If CNAME is supported then we could cache it on any given plan, otherwise it would require one which supports host header rewrites (uh… ENT only I think today).


As I understand @cscharff and @andy, they have not implemented CNAME support yet.

I’m not following @cscharff how we could cache using host header rewrites. Do you mind elaborating?


So on the Enterprise plane we support a feature called “Host Header Rewrites”. What it allows is for you to set a page rule which says when a user visits for Cloudflare to change the host header in the request to origin from to a different value (e.g. so that the origin server recognizes the request.

This feature is pretty powerful (and somewhat ripe for potential abuse) and so it’s access is limited to ENT customers who are… most days… less likely to be up to something nefarious. :wink:


I believe this is the case. My test can be found here where I have two images in the header. For the CNAME it goes into a 302 loop.


Got it. Thanks for explaining. Yeah, we are on the business plan so would not be able to utilize this feature.


On the plus side we :heart: DO, so if there’s a way we can collaborate I am sure there are already smart people on both sides discussing the best way to do it.


@cscharff and @andy is there a Cloudflare compatible object/cloud storage you might recommend besides S3?

And agreed @cscharff on DO. They are saying CNAME support is coming. But we can all show our support to hurry with this feature to their product team by upvotting this document.


I’m using a Google Cloud bucket for images on one of my sites - it’s a static site set up using this method. The HTML for the site is actually hosted via GitHub pages for version control and my Google bucket is setup as an img subdomain that contains all of my image files. I have this subdomain set up on Cloudflare as a CNAME as outlined in that article and it works just like it did on S3.


Wao deep stuff i just understood the CNAME and container stuff but since Digital Ocean is a storage for assets and is external to cloudflare from my reading on the topic the header rewrites offered by @cscharff might be the solution I mean it made sense to my little brain but further test will be needing if the assets are for queries or other databases request which in my opinion are not too friendly with redirection; just an opinion.