[英]Image not found on amazon s3 bucket
我剛剛用Amazon S3制作了回形針。 我可以成功上傳圖片。
當我嘗試渲染圖像時
<%= image_tag @client.image.url(:thumb) %>
我不能夠
<img src="http://s3.amazonaws.com/mybucket/clients/images/000/000/009/thumb/id1_001.jpg?1448466990">
我訪問網址時找不到圖片
http://s3.amazonaws.com/mybucket/clients/images/000/000/009/thumb/id1_001.jpg?1448466990
我收到消息
<Message>
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
</Message>
<Bucket>mybucket</Bucket>
<Endpoint>mybucket.s3.amazonaws.com</Endpoint>
如何配置回形針使用正確的路徑?
這發生在我身上,通過為回形針設置正確的S3主機名解決了我的問題:
我假設您必須在某些地方配置S3憑據,並進行如下配置:
paperclip_options = {
:storage => :s3,
:s3_credentials => {
:s3_host_name => PLACE YOUR BUCKET HOST NAME HERE,
:bucket => XXX,
:access_key_id => YYY,
:secret_access_key => ZZZ
},
:s3_protocol => :https
}
Paperclip::Attachment.default_options.update(paperclip_options)
請注意以下選項: s3_host_name
是解決您的問題的關鍵:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.