上传对象到私有S3不起作用

After doing a big research, I’ve not found any guide to upload images to S3 with private ACL.

I’m experiencing a weird behavior where the backups work but not uploadimg of images.

I narrowed the issue down to a problem with ACL of the bucket (I proved that the problem is the ACL since I’m able to upload file using the sdk without specifing the ACL flag). In some cases the “block access to public” permission are set at account level and not bucket level so deactivating the checkbox in the bucket config won’t work.

I noticed that the S3 upload config code was updated, and now the ACL is set based on a param, is there away to pass that config down? discourse/s3_store.rb at tests-passed · discourse/discourse · GitHub

1 个赞

Secure Media Uploads describes how to limit uploads to logged in users. Perhaps that will help?

2 个赞

I tried that, images get uploaded but I get a 500 error in the dashboard with no clue, no logs

@mahcr

我遇到了同样的问题。我可以进行备份,但由于“存储桶不允许 ACL”而无法上传图片。

对于 IAM,我附加了 AmazonS3FullAccess 策略,但仍然是同样的错误。

你有什么解决方案吗?

1 个赞

我遇到了同样的问题:备份可以正常工作,但上传失败。

本指南已过时:

本指南似乎对 CDN 部分很有价值,但不是完整的解决方案:

我也遇到了同样的问题。备份上传可以正常工作,但图片上传显示“存储桶不允许 ACL”。
通过修改 IAM 中的一个权限和存储桶中的两个设置,问题得到了解决。

首先,我根据指南 https://meta.discourse.org/t/setting-up-file-and-image-uploads-to-s3/7229 将 IAM 权限从“s3:HeadBucket”更改为“s3:ListBucket”,因为亚马逊表示 HeadBucket 不是一个有效的权限。

然后,我按照指南在存储桶的权限页面进行了完全相同的设置。

然后是最重要的部分,启用 ACL。在权限选项卡中,它被称为“编辑对象所有权”。启用 ACL 并设置为“对象写入者”后,一切都正常了。

希望我的经验能帮到你。

3 个赞