Ruby on rails 轨道4 x AWS S3:“;此内容也应通过HTTPS提供。”;
在我的Rails 4应用程序中,我使用gem允许用户上传图像 图像存储在AWS S3上 这是我在Ruby on rails 轨道4 x AWS S3:“;此内容也应通过HTTPS提供。”;,ruby-on-rails,ruby-on-rails-4,amazon-web-services,amazon-s3,https,Ruby On Rails,Ruby On Rails 4,Amazon Web Services,Amazon S3,Https,在我的Rails 4应用程序中,我使用gem允许用户上传图像 图像存储在AWS S3上 这是我在config/environments/production.rb中的配置: config.paperclip_defaults = { :storage => :s3, :s3_credentials => { :bucket => ENV['S3_BUCKET_NAME'], :access_key_id => ENV['AWS_ACCESS_KEY
config/environments/production.rb
中的配置:
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
在我实现SSL证书之前,它工作得非常好
现在,我的应用程序(在生产中)设置为HTTPS,我在控制台中遇到以下错误:
Mixed Content: The page at 'https://www.domain.com/' was loaded over HTTPS, but requested an insecure image 'http://s3.amazonaws.com/app/model/images/000/000/003/small_thumb/Profile_Picture.png?1448899439'. This content should also be served over HTTPS.
这不会“破坏”应用程序,但我想让它正常运行
如何修复此问题?通过将此选项添加到您的回形针选项哈希中,告诉回形针生成HTTPS URL:
:s3_protocol => :https