lundi 17 septembre 2018

Using Paper clip with Cloudfront

I uploaded images to my s3 and when i try to serve images from cloudfront, paper clip force s3_host_name/bucket/path which is not correct when using cloudfront The target is url like cdn.test.com/path

NOTICE : i am using a paperclip version 2.4.5, when i removed my s3.yml s3_host_name this is replaced with s3.amazonaws.com

:storage => :s3,
  :s3_credentials => "#{Rails.root}/config/s3.yml",
  :url => "http://cdn.test.com/images/:id/:id-:style.:extension",
  :path => "/images/:id/:id-:style.:extension",
  :default_url => "http://cdn.test.com/images/content/missing/:style.png"

and my s3.yml file has

production:
  bucket: bucket-prod
  access_key_id: XXXXXXXXXXX
  secret_access_key: XXXXXXXXXXXXX
  s3_host_name: s3-eu-west-1.amazonaws.com

Aucun commentaire:

Enregistrer un commentaire