我可以将图片上传到s3存储桶。 然后我检索包含图像链接的JSON对象。 这是指向存储桶的URL。
url:“https://s3.amazonaws.com/bucket-name/uploads/recepie/image/21/2013-12-13_23.25.58.jpg”
当我按下它时出现错误
<Error>
<Code>PermanentRedirect</Code>
<Message>
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
</Message>
<RequestId>2227C463FE87702A</RequestId>
<Bucket>bucket-name</Bucket>
<HostId>
20obskM************FmRoYcMDnMlH
</HostId>
<Endpoint>bucket-name.s3.amazonaws.com</Endpoint>
</Error>
我正在使用带载波和雾宝石的RoR。
答案 0 :(得分:1)
请使用此代码;
http://your_bucket_name.s3.amazonaws.com/image_path
如:
http://your_bucket_name.s3.amazonaws.com/uploads/recepie/image/21/2013-12-13_23.25.58.jpg
答案 1 :(得分:1)
试试这个, 我遇到了同样的问题并通过以下方式解决:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => '******', # required
:aws_secret_access_key => '******', # required
}
config.fog_directory = '******' # required(Your bucket name)
config.fog_public = false # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
end
答案 2 :(得分:0)
我必须替换follow并在端点中指定我的bucket区域:
:endpoint => 'https://s3.amazonaws.com'
使用:
:endpoint => 'https://s3-us-west-2.amazonaws.com'