# Link to data export on S3 does not use CDN URL

**URL:** https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573
**Category:** Bug
**Created:** [June 16, 2023, 5:11am UTC](https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573 "2023-06-16T05:11:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![nodomain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nodomain/32/303402_2.png) [@nodomain](https://meta.discourse.org/u/nodomain)
#### Post date: [June 16, 2023, 5:11am UTC](https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573/1 "2023-06-16T05:11:32Z")

</div>

When you are using a CDN URL pointing to S3 and create a data export, the link to the export is generated with the S3 URL and hence the download fails.

Please use the CDN URL there as well.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 16, 2023, 5:33am UTC](https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573/2 "2023-06-16T05:33:35Z")

</div>

That sounds like the desired behaviour. The file will be downloaded only once and is private so there is no reason that it should be cached by the CDN. Right?

---

<div class="post-metadata">

### Author: ![nodomain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nodomain/32/303402_2.png) [@nodomain](https://meta.discourse.org/u/nodomain)
#### Post date: [June 16, 2023, 5:34am UTC](https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573/3 "2023-06-16T05:34:25Z")

</div>

But it breaks if you block _direct_ access to the S3 bucket like we have to do due to company guidelines.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [June 16, 2023, 5:59am UTC](https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573/4 "2023-06-16T05:59:46Z")

</div>

Also mentioned in

- [Image lightbox "download" link pointing to S3 bucket not CDN](https://meta.discourse.org/t/image-lightbox-download-link-pointing-to-s3-bucket-not-cdn/265874)
- [Downloads coming from S3 even with DISCOURSE\_S3\_CDN\_URL set](https://meta.discourse.org/t/downloads-coming-from-s3-even-with-discourse-s3-cdn-url-set/177000)
- [S3 CDN URL not being used on non-image uploads - #4 by martin](https://meta.discourse.org/t/s3-cdn-url-not-being-used-on-non-image-uploads/175332/4)

and that last topic explains why this is:

> [@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/4):
>
> Basically we are always downloading from S3 with a presigned URL if we are doing a “force download”, which is what happens when we are clicking on the attachment link or clicking on the Download button on an image. This is so the appropriate content-disposition headers can be added:
> 
> ```plaintext
> attachment; filename="#{upload.original_filename}"; filename*=UTF-8''#{upload.original_filename}
> 
> ```
> 
> I do not think it is possible to make the CDN URL behave in this way? The CDN URL for images is only used when displaying them inline, not when downloading them. Also in the case of secure images and attachments which have a private ACL the presigned URL must _always_ be used.

It would be good if there was an option to proxy those downloads through Discourse though, if only to not expose the S3 bucket to the world.

---

<div class="post-metadata">

### Author: ![nodomain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nodomain/32/303402_2.png) [@nodomain](https://meta.discourse.org/u/nodomain)
#### Post date: [June 16, 2023, 6:28am UTC](https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573/5 "2023-06-16T06:28:56Z")

</div>

In my case I would also be ok with using the signed URL but currently it points directly to the S3 HTTPS URL.

---

<div class="post-metadata">

### Author: ![Bathinda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bathinda/32/135888_2.png) [@Bathinda](https://meta.discourse.org/u/Bathinda)
#### Post date: [April 23, 2025, 1:47pm UTC](https://meta.discourse.org/t/link-to-data-export-on-s3-does-not-use-cdn-url/268573/6 "2025-04-23T13:47:04Z")

</div>

Valid point.

@nodomain, was this ever resolved?
