Paperclip is missing the Protocol (https) with Amazon S3

后端 未结 2 808
小蘑菇
小蘑菇 2021-01-17 04:56

In production.rb:

config.paperclip_defaults = {
    s3_host_name: \"s3.#{ENV.fetch(\'AWS_REGION\')}.amazonaws.com\",
    storage: :s3,
    s3_credentials: {
         


        
相关标签:
2条回答
  • 2021-01-17 05:16

    You need to specify the scheme on paperclip configuration as below:

    config.paperclip_defaults = {
          s3_host_name: "s3.#{ENV.fetch('AWS_REGION')}.amazonaws.com",
          storage: :s3,
          :s3_protocol => :https, # <- added this
          s3_credentials: {
              bucket: ENV.fetch('S3_BUCKET_NAME'),
              access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
              secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
              s3_region: ENV.fetch('AWS_REGION'),
          }
      }
    

    :s3_protocol => :https will assign the scheme https to the url's generated for your amazon s3 assets. Refer to documentation for more details.

    0 讨论(0)
  • 2021-01-17 05:30

    You need to explicitly add the protocol to your configuration:

    :s3_protocol => :https
    
    0 讨论(0)
提交回复
热议问题