Friday, October 5, 2012

Get non-https urls for images while using when storing images on Amazon S3, using Paperclip and Fog.

What you can do is, the hash where you specify the options for paperclip, how it connects to the S3 server, ie something like this



{
:storage => :fog,
:fog_credentials => {
    :provider => 'AWS',
    :aws_access_key_id => <YOUR_ACCESS_ID> ,
    :aws_secret_access_key => <YOUR_SECRET_ACCESS_KEY>
},
:fog_directory => <YOUR_BUCKET_NAME>,
:fog_public => true,
:path => "system/:attachment/:id/:style/:filename"
}

In there, you can put in an option named "fog_host" like this:

:fog_host => "http://s3.amazonaws.com/<YOUR_BUCKET_NAME>"

This will generate urls without https and in the same format as that were generated by the aws-sdk gem. :)

No comments:

Post a Comment