问题
I have images stored in S3 with Paperclip and this error is intermittenly showing up. I had it resolved a few weeks ago by upgrading to ruby 2.1.5, but it's back now.
Here's my controller code:
def download
extension = File.extname(@gallery_photo.image_file_name)
send_data open("#{@gallery_photo.image.expiring_url(10, :original)}").read, filename: "original_#{@gallery_photo.id}#{extension}", type: @gallery_photo.image_content_type
end
Here's the error:
OpenURI::HTTPError (403 Forbidden):
Rails 4 & Ruby 2.1.5
回答1:
I had to extend the expiring_url
to 10000.
来源:https://stackoverflow.com/questions/29394881/paperclipopenurihttperror-403-forbidden-with-amazon-s3-storage