# S3 CDN URL ignored when uploading into posts

**URL:** <https://meta.discourse.org/t/s3-cdn-url-ignored-when-uploading-into-posts/54898>\
**Category:** Bug\
**Created:** [28. Dezember 2016 um 18:31 UTC](https://meta.discourse.org/t/s3-cdn-url-ignored-when-uploading-into-posts/54898 "2016-12-28T18:31:44Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![DanielMarquard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielmarquard/32/74010_2.png) [@DanielMarquard](https://meta.discourse.org/u/DanielMarquard)\
**Post date:** [28. Dezember 2016 um 18:31 UTC](https://meta.discourse.org/t/s3-cdn-url-ignored-when-uploading-into-posts/54898/1 "2016-12-28T18:31:44Z")

</div>

All of our traffic goes through CloudFront, and static content is fetched by CloudFront from one of several S3 buckets.

With uploads being sent to S3, Discourse embeds the content with a generic bucket URL despite our having `s3 cdn url` set. Once submitted, posts appear to use the correct URL set in `s3 cdn url`, although this may also be because we have `DISCOURSE_CDN_URL` set as well (both are set to the same URL).

The post preview window references the standard S3 URL seen in the unbaked post, though. This is a problem because we use a private ACL on files uploaded to our Discourse uploads bucket, as content on this bucket should never be accessed outside of CloudFront. The result is a broken image in the preview window.

 ![](https://global.discourse-cdn.com/meta/original/3X/4/d/4d96f8f4542d396e51c81013e7fdbd674912b115.png)

---

_[View the full topic](https://meta.discourse.org/t/s3-cdn-url-ignored-when-uploading-into-posts/54898)._
