In the official discourse S3-compatible object storage setup guide, it mentions that Cloudflare R2 is not supported, because it doesn’t handle gzipped files correctly. But Cloudflare fixed this in the 2023-03-16 update, and I tested it, and it works great on discourse.aosus.org. Even old broken gzip handling tests work now, so it looks like the problem is solved!
EDIT: Discourse doesn’t use the CDN URL for direct downloads, rather it uses the S3 API link, which doesn’t work for Cloudflare R2, so any attachments not embedded in the post won’t work
You have to enable Use S3 CDN for all uploads in the settings.
And Cloudflare R2 is free for up to 10GB! (10,000,000 reads, 1,000,000 writes), so for your average discourse forum, its probably not going to cost you anything!
setup
Follow any pre-environment step in the official setup guide
environment setup
|
|
I’ve been using it for a month now, and it’s working great, no problems and fantastic speed when viewing images. There is one caveat though, you can’t configure a separate S3 host for backups and the CF R2 isn’t the cheapest for storage.