Why can't my Qiniu Cloud S3 attachments load in the forum after successful upload?

סיכום מבוסס בינה מלאכותית

用户 rocher 在使用七牛云 S3 作为 Discourse 附件存储时,虽然上传成功,但在论坛中无法加载视频,浏览器提示 download token not specified。他怀疑是未配置私有 bucket 的鉴权,但不确定如何设置。Lilly 建议参考 Discourse 官方 S3 配置文档,并提供了 app.yml 中可能需要的配置项示例,包括访问密钥、端点、CDN 地址等。pfaffman 也指出问题可能出在配置上,需确认是否适配了 i4ta.com 域名。rocher 补充说明已通过 Docker 安装并在后台配置了 AK/SK,仍无法查看,且未找到可配置 CDN 链接带 token 的选项。rocher 还上传了当前配置截图寻求确认。最终,pangbo 指出关键在于开启 Discourse 后台的 Secure uploads 选项,该选项会为私有存储的附件链接自动签名,开启后需重新 rebake 帖子才能生效。rocher 确认问题已解决,并感谢 pangbo 的帮助。

Successfully uploaded to cloud storage vendor Qiniu Cloud, the loaded link is: https://img.i4ta.com/original/1X/5be788f6a5e3d0efa278e1e87b6c6ca6be2ce4cf.mp4, and the browser prompts:

{
"error": "download token not specified"
}

The video loaded in the topic:


<video width="100%" height="100%" preload="metadata" controls="" style="display:none">
          <source src="https://img.i4ta.com/original/1X/5be788f6a5e3d0efa278e1e87b6c6ca6be2ce4cf.mp4">
          <a href="https://img.i4ta.com/original/1X/5be788f6a5e3d0efa278e1e87b6c6ca6be2ce4cf.mp4">https://img.i4ta.com/original/1X/5be788f6a5e3d0efa278e1e87b6c6ca6be2ce4cf.mp4</a>
        </video>

Is it not using private bucket authentication? But I don’t know where to configure it. Are there any experts who know how to solve this?

have you read this topic?

I don’t know anything about Qiniu Cloud or if their S3 storage is supported, but you will need an access key and token (I believe they are generated in your Qinui Cloud console). If it’s possible, your app.yml file settings should probably look something like this example:

## S3 storage
  DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: whatever
  DISCOURSE_S3_ENDPOINT: http://s3-ap-southeast-1.qiniucs.com
  DISCOURSE_S3_ACCESS_KEY_ID: *************
  DISCOURSE_S3_SECRET_ACCESS_KEY: *****************
  DISCOURSE_S3_CDN_URL: http://qiniu.pengfeima.cn
  DISCOURSE_S3_BUCKET: qiniu-s3
  DISCOURSE_S3_BACKUP_BUCKET: qiniu-s3/backups
  DISCOURSE_BACKUP_LOCATION: s3

Indeed https://img.i4ta.com/original/1X/5be788f6a5e3d0efa278e1e87b6c6ca6be2ce4cf.mp4 gives that error. You’ll need to check somewhere that people know about your to configure i4ta. I’m pretty sure that it has to do whey the configuration there.

Yes, I installed it via docker-compose, and I have configured the AK and SK in the Discourse backend, and I can successfully upload files. The only issue is that I cannot view them. I have checked all possible configurations and haven’t found where to configure adding the token to the CDN link when accessing it. Since this storage is private, the token must be included. Are there any other places besides the configuration you mentioned above?


Here is my configuration, is it correct? Are there any other related configurations needed?

If your S3 bucket is private, you need to enable the Secure uploads option, otherwise Discourse will not attempt to sign attachment links.

After changing this setting, you must rebake the post for it to take effect.

Thank you very much, it was indeed the effect of this setting, it has troubled me for a week, thank you very much for your help~