Carrierwave and Linode Object Storage

Hello,

Using Rails 5.2, I'm having trouble getting the carrierwave config right in order to get image uploads working with Linode's object storage.

I can save an object through the rails console without problems with the access keys, bucket and endpoint info:

client = Aws::S3::Client.new(
  endpoint: "...",
  access_key_id: "...",
  secret_access_key: "...",
  region: "default",
)

client.put_object({
  bucket: "...",
  key: "test-object",
  body: 'Hello World!'
})

Here's the carrierwave config:

CarrierWave.configure do |config|
  config.storage = :fog
  config.fog_provider = 'fog/aws'
  config.fog_credentials = {
    provider:              'AWS', 
    aws_access_key_id:     '...',    
    aws_secret_access_key: '...', 
    region:                'default',
    endpoint:              '...'
  }
  config.fog_directory  = '<my-bucket>'
  config.fog_public     = false
  config.fog_attributes = {
    'Cache-Control' => "max-age=#{365.day.to_i}",
    'X-Content-Type-Options' => "nosniff"
  }
end

I'm probably missing a detail here, another pair of eyes would be great :)

thanks,
Oliver

2 Replies

The error I get is a validation error on the file type, requiring it to be jpeg, jpg or png. Though it's a jpeg I'm uploading.

…just started working, out of the blue. No new changes to config or system :shrug:

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct