I've got Storage setup with DO Spaces, and I was wondering what the best approach would be for serving images via the DO CDN instead of via the SDK? I'm not sure if it's already being served from the CDN or not but I'm serving A LOT of images so just want to make sure that I'm utilising the CDN where possible.
I'm self-hosting and using the JS SDK
Summary
The user wants to serve files via a CDN instead of using Storage in their self-hosted setup with the JS SDK. They mentioned trying Cloudflare's reverse proxy CDN, but it is not allowed. An alternative suggested is to directly interact with the DigitalOcean storage API with a custom function but security may be a concern. If the images are publicly available, it is recommended to use Cloudflare and cache them there. The user plans to use the CDN URL provided by DigitalOcean.
Ryan
Moderator
Dec 12, 2023, 22:36
Serve files via CDN instead of Storage?
D5
Dec 12, 2023, 23:18
If the images are publicly available I would just use Cloudflare and cache them there
D5
Dec 12, 2023, 23:19
By default all images goes through your appwrite instance so the DigitalOcean CDN is useless
D5
Dec 12, 2023, 23:20
An alternative is basically serving the URL with a function manually and interacting with DO storage API directly. The main concern here will be security
Ryan
Moderator
Dec 12, 2023, 23:22
I had a feeling that would be the case, just wasn't sure if there was anything I had missed within Appwrite itself. The images are all publicly available so I'll probably be fine with just serving up the CDN URL I think. Most of the site is images so it's a lot of data to be sending through Appwrite
Ryan
Moderator
Dec 12, 2023, 23:23
Thank you!
D5
Dec 12, 2023, 23:34
Edit on this: Cloudflare's reverse proxy CDN doesn't allow that (it violates their TOS since it will be serving a huge amount of non web content), for those who want this solution, will need to use their images product or just using the DO URL as suggested too