# Configure an S3 compatible object storage provider for uploads

**URL:** https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916
**Category:** Self-Hosting
**Tags:** cdn, configuring, how-to, reference
**Created:** [April 22, 2020, 10:37pm UTC](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916 "2020-04-22T22:37:37Z")
**Posts on this page:** 1
**Showing post:** 418

<div class="post-metadata">

### Author: ![aosus](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@aosus](https://meta.discourse.org/u/aosus)
#### Post date: [June 8, 2023, 6:02pm UTC](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916/418 "2023-06-08T18:02:57Z")

</div>

We have just discovered a problem, Cloudflare R2 doesn’t allow public-read from the S3 endpoint URL, rather only the custom domain or a random `r2.dev` domain.  
(Pre-signed downloads work, just no direct public access is supported.)  
But discourse only uses the CDN URL for embedded images, and not direct downloads, which use the S3 endpoint URL.  
Is there a way to make it use the CDN URL for all files, or force the use of a presigned url?

Related:

> [@S3 CDN URL not being used on non-image uploads](https://meta.discourse.org/t/s3-cdn-url-not-being-used-on-non-image-uploads/175332/9):
>
> Ok so I found the place where [Markdown for attachments is generated](https://github.com/discourse/discourse/blob/v2.8.0.beta11/app/assets/javascripts/discourse/app/lib/uploads.js#L269) and as far as I understand the plugin API one cannot (easily) override it (I even think one should not do it). So my initial thought of adding a ?dl=1 param to those urls seems like the wrong way to do it. Regarding not-forcing downloads for resolved short-urls: If I understand [the argument against public ACLs on S3 buckets](https://meta.discourse.org/t/s3-cdn-url-ignored-when-uploading-into-posts/54898/4) correctly, one should either: serve files from S3 via a CDN (unfeasible for attachments as @martin poi…

The workaround mentioned in that post works, add `?dl=1` fixes it, because its forces discourse to use a presigned S3 URL.

---

_[View the full topic](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916)._
