Paperclip amazon s3 serve html files.
Hello.
If for some reasons you decide to serve html files using s3 and paperclip gem you should use content-type and content-disposition header fields on uploading html file to the s3.
Example how to use s3_headers with paperclip gem:
has_mongoid_attached_file :item,
s3_headers: proc { |instance|
{}.tap do |hash|
hash.merge!(
content_disposition: 'inline',
content_type: 'text/html'
) if File.extname(instance.path).include?('html')
end
}
Written by Alexandr Korsak
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#