未指定端点的永久重定向 s3

发布于 2024-09-25 19:14:44 字数 717 浏览 2 评论 0原文

我正在尝试 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

我缺少什么?提前谢谢!

I'm experimenting with s3 but im 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梨涡少年 2024-10-02 19:14:44

使用 paperclip 版本 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'

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'
秋叶绚丽 2024-10-02 19:14:44

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

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.

雨落星ぅ辰 2024-10-02 19:14:44

我们可以像下面的代码一样使用默认端点。

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"

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"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文