I'm trying to get carrierwave
to work with Amazon S3 (in my Rails 4 app), I use fog
gem to upload the images to s3
.
I'm currently successfully able to upload the files to my bucket. But I cannot get the images back. server is giving 403 (Forbidden)
error
However if I check the image, it's there uploaded in S3. My image path would be something like
https://<bucket name>.s3.amazonaws.com/uploads/image/picture/8/card_34676_l.jpg&Signature=<signature>&Expires=<expires>
Following is my carrierwave
config
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => '<key>',
:aws_secret_access_key => '<access key>',
}
config.fog_directory = '<bucket name>'
config.fog_public = false
config.fog_attributes = {'Cache-Control'=>"max-age=#{365.day.to_i}"} # optional, defaults to {}
end
and I have setup the default grantee permission to everyone
with
- list
- upload/delete
- view permissions
and have a default CORS Configuration
setup
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
What could be missing?