开发者

permanentredirect s3 for unspecified endpoint

I'm experimenting with s3 but im 开发者_JAVA百科running into a permission problem (i think).

Output:

 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.

I'm using ckeditor. My Ckeditor::Picture class includes this:

  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

In the s3.yml, ive got:

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

What am I missing? thx in advance!


With paperclip version 3.1.4, simply adding a s3_host_name key to my s3.yml file worked:

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


I suppose your bucket is not in US Standard zone. Have you tried to add "AWS_CALLING_FORMAT: SUBDOMAIN" to your .yml file? The request should be pointed then to the endpoint corresponding with the region of your bucket.


We can use default endpoint like following code.

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"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜