您尝试访问的存储桶必须使用指定的端点进行寻址

The bucket you are attempting to access must be addressed using the specified endpoint

我在最新的 rails (4.2.6) 项目中使用回形针 5.0.0.beta2。该应用程序托管在 Heroku 上。我可以上传一张图片,它似乎存储在 Amazon S3 的存储桶中。然而在浏览器中图像似乎有一个损坏的 url,尽管它指向 Amazon S3 上的存储桶,url 是:

http://s3.amazonaws.com/gigbnb/profiles/profile_pics/000/000/002/small/anthony_candaele-300x300.jpg?1464956858

当我在浏览器中输入此 url 时,我得到一个 xml 页面,其中包含以下错误消息:

The bucket you are attempting to access must be addressed using the     specified endpoint. Please send all future requests to this endpoint.

S3 端点似乎有问题。

但是我在配置文件中设置了区域 (eu-west-1):

config/environments/production.rb


config.paperclip_defaults = {
   storage: :s3,
   s3_region: ENV.fetch('AWS_REGION'),
   s3_credentials: {
     bucket: ENV.fetch('S3_BUCKET_NAME'),
     access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
     secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
   }
}

我的 Github 存储库位于:

https://github.com/acandael/gigbnb

有谁知道发生了什么事吗?

感谢您的帮助,

安东尼

这是 workaround 解决了我的问题。由 aminariana

呈现