我正在尝试使用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!
答案 0 :(得分:8)
使用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'
答案 1 :(得分:2)
我想你的水桶不在美国标准区。您是否尝试将“AWS_CALLING_FORMAT:SUBDOMAIN”添加到.yml文件中?然后应该将请求指向与您的存储区域对应的端点。
答案 2 :(得分:0)
我们可以使用默认端点,如下面的代码。
if (Cache["key_pincodes"] == null)
{
// if No object is present in Cache, add it to the cache with expiry time of 10 minutes
// Read data to datatable or any object
DataTable pinCodeObject = GetPinCodesFromdatabase();
Cache.Insert("key_pincodes", pinCodeObject, null, DateTime.MaxValue, TimeSpan.FromMinutes(10));
}
else // If pinCodes are cached, dont make Database call and read it from cache
{
// This will get execute
DataTable pinCodeObject = (DataTable)Cache["key_pincodes"];
}
// bind it your dropdown