Here’s some information about this, I was dealing with this last month.
I fixed it by setting both variables (DISCOURSE_S3_CDN_URL
and DISCOURSE_CDN_URL
) and creating two CloudFront distributions, one for the uploads with origin the S3 bucket, and one for the assets with origin the server.
Here’s the code we use for this
- Cloudfront distribution with S3 as origin infra/live/prod/services/discourse/cloudfront.tf at master · debtcollective/infra · GitHub
- Cloudfront distribution with Server as origin infra/live/prod/services/discourse/cloudfront.tf at master · debtcollective/infra · GitHub
Here’s our app.yml (we named it web.yml), we replace variables at build time infra/modules/services/discourse/web.yml at master · debtcollective/infra · GitHub