The s3 cdn url setting makes no effect

Hi everyone!

The s3 cdn url setting works well for photos but it makes no effect for other kinds of files. It appears that the s3 cdn url was replaced by the endpoint url for uploaded files.

for example, my s3 cdn url is, my s3 endpoint url is When I click the short url on discourse, it links to, but the correct url should use cdn url rather than endpoint url.

How can I solve this problem?

On my site, S3 parameters were set on the panels, not in the app.yml.

Did you run the rake task to precompile assets and push to S3?
As described in
Set up file and image uploads to S3

I have configured relevant settings on admin panel, but I need to modify the app.yml and then rebuild app? I know how to do it but it seems risky.

You can run the rake task without rebuilding like this:

./launcher enter app
rake assets:precompile rake s3:upload_assets

Thank you very much!

I did as you said, but my website has broken. The uploaded assets are *.gz.js which have encoding problems.

What cdn are you using?

It is called qiniu which is a Chinese cloud service provider.

The problem is caused by cdn?

here is my setting:

  ## S3 storage
  DISCOURSE_S3_ACCESS_KEY_ID: *************
  DISCOURSE_S3_SECRET_ACCESS_KEY: *****************
  DISCOURSE_S3_BACKUP_BUCKET: qiniu-s3/backups

Do you get the same file with the same headers if you use the CDN as you do when you get the asset directly from the bucket?

Thanks for your patience!

I can download the file directly with such link It is the same file used in the browser, which is downloaded with cdn.

1 Like

I think there is some problems during upload assets(only photos are correct). I won’t use cdn for assets anymore.

Thanks again!

1 Like