Is it possible to configure Paperclip to produce HTTPS urls for S3?

前端 未结 2 1489
谎友^
谎友^ 2020-12-14 14:47

I\'m using Paperclip to manage user-uploaded images on a site that is served entirely under HTTPS. In order to avoid the silly security warnings on IE7/IE8, I need to also

2条回答
  •  悲哀的现实
    2020-12-14 15:15

    To update your code just say, add the :s3_protocol as following:

    class Product < ActiveRecord::Base
    has_attached_file :image,
                  :styles => {
                      :large => {:geometry => "616x450#"}
                  },
                  :storage => :s3,
                  :s3_credentials => {:access_key_id => "xxx", :secret_access_key => "xxx"},
                  :s3_protocol => :https,
                  :path => ":attachment/:id/:style/:basename.:extension",
                  :bucket => CONFIG['s3_media_bucket'],
                  :default_url => "/assets/image_missing.png"
    

提交回复
热议问题