jrgifford / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
http://www.jstorimer.com/ruby/2010/01/30/delayed-paperclip.html
MIT License
402 stars 155 forks source link

Not working with S3 storage and CloudFront #174

Closed eduardm closed 8 years ago

eduardm commented 8 years ago

While it is working perfectly with S3 storage, if changing Paperclip to use CloudFront, something like this:

has_attached_file 
     :media,
    :storage => :s3,
    :s3_region => "us-east-1",
    :s3_credentials => credential_file,
    :url => ":s3_alias_url",
    :s3_host_alias => "media.mydomain.com",
    :bucket => "mybucket",
    :path => ":class/:style/:year/:month/:day/:id/:hash.:extension",
    :hash_secret => hash_secret

With this configuration, Paperclip will store the files on S3 "mybucket", but will return links from media.mydomain.com (CloudFront).

Adding delayed_paperclip to this config, will result in "No such file or directory @ rb_sysopen"

With the same system, but changing a bit Paperclip's configuration by removing s3_host_alias and path:


has_attached_file 
     :media,
    :storage => :s3,
    :s3_region => "us-east-1",
    :s3_credentials => credential_file,
    :url =>":class/:style/:year/:month/:day/:id/:hash.:extension",
    :bucket => "mybucket",
    :hash_secret => hash_secret

it is working fine.