PaperclipOpenURI::HTTPError (403 Forbidden) with Amazon S3 Storage

蹲街弑〆低调 提交于 2019-12-13 05:48:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!