[英]Why does my image url from Amazon S3 have AWSaccesskey and expiration even though I made the bucket public?
Here is the policy I added: 这是我添加的政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MakeItPublic",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucketname/*"
}
]
}
I created an IAM and attached the AmazonS3FullAccess to that IAM. 我创建了一个IAM,并将AmazonS3FullAccess附加到该IAM。
In my rails app, I display the pictures like this: 在我的rails应用程序中,我显示如下图片:
- @pictures.each do |picture|
%img{src: picture.image_url}
and the generated url is something like: 生成的网址类似于:
https://leaguedraw.s3-us-west-2.amazonaws.com/uploads/73dfe6c6-0c25-496c-be9f-6f2beb75d7c3.png?AWSAccessKeyId=myaccesskey&Expires=1434472944&Signature=d1vIYOQt410%2BgcXs6%2BATSCsG2Mk%3D
when I just want this: 当我只想要这个时:
https://leaguedraw.s3-us-west-2.amazonaws.com/uploads/73dfe6c6-0c25-496c-be9f-6f2beb75d7c3.png
What else do I need to do to generate the latter url? 我还需要做什么来生成后一个URL?
Additional info: using carrierwave gem and carrierwave-aws gem 附加信息:使用carrierwave gem和carrierwave-aws gem
Turns out I need to change the acl in the configuration file from 原来我需要从以下位置更改配置文件中的acl
config.aws_acl = :'public-read'
to 至
config.aws_acl = :public_read
even though the documentation said to use :'public-read'
. 即使文档说使用
:'public-read'
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.