markevans / dragonfly-s3_data_store

S3 data store for the Dragonfly ruby gem
MIT License
62 stars 58 forks source link

Dragonfly S3 failing with Excon::Errors::SocketError / OpenSSL::SSL::SSLError #10

Closed biot023 closed 9 years ago

biot023 commented 10 years ago

Hi -- I have a pre-1.0 Dragonfly app that uploads and retrieves images fine. However, when I try to upgrade to 1.0.5, and use this gem to handle the data store, I get the following error:

Excon::Errors::SocketError - hostname "www.myapp.com-images-production.s3-eu-west-1.amazonaws.com" does not match the server certificate (OpenSSL::SSL::SSLError)

My config looks (kind-of) like this:

app.configure do
  plugin :imagemagick
  datastore(
    :s3,
    bucket_name: "www.myapp.com-images-production",
    access_key_id: "<REDACTED>",
    secret_access_key: "<REDACTED>",
    region: "eu-west-1"
  )
end

And is basically the same values as the config for the app that's working fine.

Could you please advise me on what I could do to get this working?

Thanks, Doug.

newbamboo commented 10 years ago

that doesn't look like a valid region?

biot023 commented 10 years ago

Sorry, that should read "eu-west-1" -- I copied and pasted the wrong bit out of another, longer post! I've edited it -- thanks for spotting that!

biot023 commented 10 years ago

Oh, but I'm still having the same problem. I'm wondering if it's related to this issue: https://github.com/fog/fog/issues/1571#issuecomment-50627643 I've forked and am having an investigate.

biot023 commented 10 years ago

Okay, I've got it working -- the issue is indeed related to the issue I mentioned in my other post. The fix for me was to specify that I should use path_style: true in my config, which is available from the :fog_storage_options key passed to configure the datastore, like so:

app.configure do
  plugin :imagemagick
  datastore(
    :s3,
    bucket_name: "www.myapp.com-images-production",
    access_key_id: "<REDACTED>",
    secret_access_key: "<REDACTED>",
    region: "eu-west-1",
    fog_storage_options: { path_style: true }
  )
end

With that, the images are served properly. Fingers crossed for whilst I'm testing uploads, now ... :)