So for the backend of an app, the API server is hosted on my own server. The DNS of this API server goes through Cloudflare. Cloudflare is also the proxy for the API server. This is already operational nicely.
Now we are adding a feature to allow people to upload videos on the app. Obviously we prefer to store the videos on AWS S3.
How can I set up Cloudflare so that I can use the CDN for the content stored on S3? So when the API server returns the AWS URI of a video, that content is served via Cloudflare.
The uploads and downloads will go through your API server.
If doing a quick drawing, it will look to something like that:
Users <-> Cloudflare <-> API server <-> S3
Regarding caching, it’s also possible. To do it, I like to use page rules and set it to do
Cache Level: Cache Everything (on this content only)
(I use “signed URLs” for content retrieval so it’s still authenthicated requests but it can be cached and even made public)