Uploads to AWS S3 and Configured CDN

AI-generated summary

A user has migrated Discourse uploads and backups to AWS S3 and is receiving a warning about the lack of a configured S3 CDN, despite using Cloudflare for traffic routing. plipsqueek questions whether a CDN is still necessary given Cloudflare’s free tier and caching capabilities. itsbhanusharma advises configuring a CDN, preferably CloudFront, and warns against using Cloudflare optimizations due to known issues. Stephen raises concerns about whether Cloudflare is actually caching uploads and confirms that proxying the site FQDN is insufficient, questioning if the S3 bucket’s DNS name is being proxied by Cloudflare.

I have my Discourse instance set up since 2019 on a DigitalOcean server, configured so traffic goes through Cloudflare. Today I migrated my uploads and backups to S3, and after completing the migration I saw this warning on my Admin dashboard:

Some advice based on your current site settings

Discourse doesn’t know that Cloudflare is routing traffic to it, so it makes sense that this warning appears. But given that I’m on the free tier of Cloudflare and that it still provides some degree of caching, is it still recommended for me to configure a CDN? If so, what additional steps do I need to take to properly configure DISCOURSE_CDN_URL? What value should I set that env variable to?

Thanks in advance.

I would say you should configure a CDN (preferably cloudfront) try not to use cloudflare optimisations with discourse as those are known to break things.

Are you sure that Cloudflare is caching your uploads and backups? Does your S3 bucket have a DNS name which is proxied by Cloudflare?

Proxying the site FQDN isn’t enough.