permanentredirect s3用于未指定的端点

我正在尝试使用s3,但我遇到了许可问题(我认为)。

输出:

AWS::S3::PermanentRedirect in CkeditorController#create The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. 

我正在使用ckeditor。 我的Ckeditor :: Picture类包括:

  has_attached_file :data, :s3_credentials => "#{Rails.root}/config/s3.yml", :storage => :s3, :path => ":attachment/:id/:style.:extension" validates_attachment_size :data, :less_than=>2.megabytes 

在s3.yml中,我得到了:

 access_key_id: "key" secret_access_key: "key" bucket: "name" AWS_CALLING_FORMAT: SUBDOMAIN 

我错过了什么? 提前thx!

我想你的水桶不在美国标准区。 您是否尝试将“AWS_CALLING_FORMAT:SUBDOMAIN”添加到.yml文件中? 然后应该将请求指向与您的存储区域对应的端点。

使用s3_host_name 3.1.4版,只需将s3_host_name键添加到我的s3.yml文件中即可:

 development: bucket: 'bucket.name' access_key_id: 'xxx' secret_access_key: 'xxx' s3_host_name: 's3-eu-west-1.amazonaws.com' 

我们可以使用默认端点,如下面的代码。

 s3_credentials: { access_key_id: AWS_CONFIG['access_key_id'], secret_access_key: AWS_CONFIG['secret_access_key'], bucket: AWS_CONFIG['bucket'], }, s3_host_name: 's3.amazonaws.com', s3_endpoint: 's3.amazonaws.com', storage: :s3, s3_headers: { "Cache-Control" => "max-age=31557600" }, s3_protocol: "https", bucket: AWS_CONFIG['bucket'], :url =>':s3_domain_url', :path => '/:class/:attachment/:id_partition/:style/:filename', default_url: "/:class/:attachment/:id/:style/:basename.:extension", default_style: "medium"