问题描述
一直在试图让载波与亚马逊s3一起工作。而不是
存储:s3
我有
存储:fog
pre>
将其更改为存储:s3立即显示错误
所以我把它改为存储:像下面的rdoc一样的雾。
然而,当我尝试上传图片时,我会发现这个疯狂的错误。我使用设计宝石。
我的完整堆栈跟踪是
Excon :: Errors :: MovedPermanently in RegistrationsController#update
Excon :: Errors :: MovedPermanently(Expected(200)< =>实际(301永久移动)
request = > {:connect_timeout => 60,:headers => {Content-Length=> 95472,Content-Type=>image / jpeg,x-amz-acl=> private,Cache-Control=>max-age = 315576000,Date=>Thu,2012年5月17日05:28:55 +0000,Authorization=>AWS AKIAIN6SC3YSGBSUKV4Q :kZOG9mG01jYn48ImFMYbgxAAQRk =,Host=>user.a.777.s3-eu-west-1.amazonaws.com:443},:instrumentor_name =>excon,:mock => false, :read_timeout => 60,:retry_limit => 4,:ssl_ca_file =>/ Users / sasha / .rvm / gems / ruby-1.9.3-p125 / gems / excon-0.13.4 / data / cacert。 pem,:ssl_verify_peer => true,:write_timeout => 60,:host =>user.a.777.s3-eu-west-1.amazonaws.com,:path =>/ uploads %2Fuser%2Fimage%2F59%2Fidea.jpg,:port =>443,:query => ; nil,:scheme =>https,:body =>#< File:/Users/sasha/Desktop/rails_projects/blue_eyes/public/uploads/tmp/20120516-2228-19160-9893/idea.jpg> ;,,expects => 200,:idempotent => true,:method =>PUT}
response => #< Excon :: Response:0x007fd72a146820 @body =<?xml version = \1.0\encoding = \UTF-8\?> \\\
< Error>< Code> PermanentRedirect< / Code>< Message>您尝试访问的存储桶必须使用指定的端点进行寻址。请将以后的所有请求发送到此端点。< / Message>< RequestId> F5F5AF888E837622< / RequestId>< Bucket> ; user_a.777< / Bucket>< HostId> IShK3GIthzCQysLOKXnR + ijJiHmMuUtXBOpFxQM4uCvJgkEHfmFn43LL4oWmpT82< / HostId>< Endpoint> s3.amazonaws.com< / Endpoint>< / Error>,@headers = {x-amz- request-id=>F5F5AF888E837622,x-amz-id-2=>IShK3GIthzCQysLOKXnR + ijJiHmMuUtXBOpFxQM4uCvJgkEHfmFn43LL4oWmpT82,Content-Type=>application / xml,Transfer-Encoding=> ;chunked,Date=>Thu,17 May 2012 05:29:00 GMT,Connection=>close,Server=>AmazonS3},@ status = 301& ;):
app / controllers / registrations_controller.rb:30:在`update'
我不知道这甚至是什么意思。
在我的初始化程序/ carrierwave.rb我有..
CarrierWave.configure do | config |
config.fog_credentials = {
:provider => 'AWS',#required
:aws_access_key_id => 'somekey',#required
:aws_secret_access_key => 'secretkey',#required
:region => 'eu-west-1'#可选,默认为'us-east-1'
}
config.fog_directory ='bucket.name'#required
#config.fog_host ='https ://s3.amazonaws.com'#可选,默认为nil
config.fog_public = false#可选,默认为true
config.fog_attributes = {'Cache-Control'=>'max-年龄= 315576000'}#可选,默认为{}
end
和我的上传文件有
#storage:s3
storage:fog
def store_dir
uploads / {model.class.to_s.underscore} /#{mounted_as} /#{model.id}
end
我的宝石文件有
gem'carrierwave'
gem'thin'
宝贝'雾'
当我启动我的服务器,而不是webrick,它使用薄的开发。
我的配置是否出错?
的帮助将不胜感激!
ive被超越了这个载波/ s3问题解决方案我今天早些遇到这个,该地区的问题。只需拿出来,让它默认设置。
CarrierWave.configure do | config |
config.fog_credentials = {
:provider => 'AWS',#required
:aws_access_key_id => 'somekey',#required
:aws_secret_access_key => 'secretkey'#required
}
config.fog_directory ='bucket.name'#required
#config.fog_host ='https://s3.amazonaws.com'#可选,默认为nil
config.fog_public = false#可选,默认为true
config.fog_attributes = {'Cache-Control'=>'max-age = 315576000'}#可选,默认为{}
end
ive been trying to get carrierwave to work with amazon s3. instead of
storage :s3
i have
storage :fog
changing it to storage :s3 gives an immediate error
so i changed it to storage :fog like the rdoc below says.
http://rubydoc.info/gems/carrierwave/frames
however when i try to upload an image, i get this crazy error. im using the devise gem as well.
my full stack trace is
Excon::Errors::MovedPermanently in RegistrationsController#update Excon::Errors::MovedPermanently (Expected(200) <=> Actual(301 Moved Permanently) request => {:connect_timeout=>60, :headers=>{"Content-Length"=>95472, "Content-Type"=>"image/jpeg", "x-amz-acl"=>"private", "Cache-Control"=>"max-age=315576000", "Date"=>"Thu, 17 May 2012 05:28:55 +0000", "Authorization"=>"AWS AKIAIN6SC3YSGBSUKV4Q:kZOG9mG01jYn48ImFMYbgxAAQRk=", "Host"=>"user.a.777.s3-eu-west-1.amazonaws.com:443"}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/sasha/.rvm/gems/ruby-1.9.3-p125/gems/excon-0.13.4/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"user.a.777.s3-eu-west-1.amazonaws.com", :path=>"/uploads%2Fuser%2Fimage%2F59%2Fidea.jpg", :port=>"443", :query=>nil, :scheme=>"https", :body=>#<File:/Users/sasha/Desktop/rails_projects/blue_eyes/public/uploads/tmp/20120516-2228-19160-9893/idea.jpg>, :expects=>200, :idempotent=>true, :method=>"PUT"} response => #<Excon::Response:0x007fd72a146820 @body="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><RequestId>F5F5AF888E837622</RequestId><Bucket>user.a.777</Bucket><HostId>IShK3GIthzCQysLOKXnR+ijJiHmMuUtXBOpFxQM4uCvJgkEHfmFn43LL4oWmpT82</HostId><Endpoint>s3.amazonaws.com</Endpoint></Error>", @headers={"x-amz-request-id"=>"F5F5AF888E837622", "x-amz-id-2"=>"IShK3GIthzCQysLOKXnR+ijJiHmMuUtXBOpFxQM4uCvJgkEHfmFn43LL4oWmpT82", "Content-Type"=>"application/xml", "Transfer-Encoding"=>"chunked", "Date"=>"Thu, 17 May 2012 05:29:00 GMT", "Connection"=>"close", "Server"=>"AmazonS3"}, @status=301>): app/controllers/registrations_controller.rb:30:in `update'
i dont know what that even means.
in my initializers/carrierwave.rb i have..
CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', # required :aws_access_key_id => 'somekey', # required :aws_secret_access_key => 'secretkey', # required :region => 'eu-west-1' # optional, defaults to 'us-east-1' } config.fog_directory = 'bucket.name' # required #config.fog_host = 'https://s3.amazonaws.com' # optional, defaults to nil config.fog_public = false # optional, defaults to true config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {} end
and my uploader file has
#storage :s3 storage :fog def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end
my gem file has
gem 'carrierwave' gem 'thin' gem 'fog'
when i boot my server, instead of webrick, it uses thin in development as well.
are my configurations wrong?help would be much appreciated!ive been super stuck on this carrierwave/s3 issue
解决方案I ran into this the earlier today and it was a problem with the region. Just take it out and let it be set by the default.
CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', # required :aws_access_key_id => 'somekey', # required :aws_secret_access_key => 'secretkey' # required } config.fog_directory = 'bucket.name' # required #config.fog_host = 'https://s3.amazonaws.com' # optional, defaults to nil config.fog_public = false # optional, defaults to true config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {} end
这篇关于载波,Excon :: Errors :: MovedPermanently在RegistrationsController#更新错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!