ruby on rails - Paperclip is not generating url properly for CNAME -
i'm tying cloudfront distribution wired custom domain paperclip it's not generating url properly. here configuration:
# initializers/paperclip_defaults.rb paperclip::attachment.default_options.merge!({ :storage => :s3, :s3_credentials => "#{rails.root}/config/amazon_s3.yml", :bucket => "my-image-bucket", :path => "production/attachments/:attachment/:id/:style/:basename.:extension", :url => ":s3_host_alias", :s3_headers => {'cache-control' => 'max-age=2147483648'}, :s3_protocol => :https, :s3_host_alias => "cdn.mydomain.com", })
according docs , every blog post i've read should correct. problem winds generating this:
https://s3.amazonaws.com/my-image-bucket/production/products/images/44/original/my-image.jpg
the way i've gotten use cname specifying s3_host_name
according documentation used tokyo region. , breaks uploads. ideas i'm doing wrong?
i'm using paperclip 3.5.2
.
update
i'm debugging inside attachment.rb#url
, here's i'm seeing. paperclip::attachment.default_options[:url]
returns cdn.mydomain.com
correct. however, @options[:url]
returning :s3_path_url
instead of s3_host_alias
. reason default option not being merged in properly. s3_host_alias
option since @options[:s3_host_alias]
returning cdn.mydomain.com
expected.
so turns out :s3_alias_url
correct token use url , not :s3_host_alias
. not sure that's documented though. had @ s3.rb
figure out.
Comments
Post a Comment