我一直试图让carrierwave与亚马逊s3合作.代替
storage :s3
Run Code Online (Sandbox Code Playgroud)
我有
storage :fog
Run Code Online (Sandbox Code Playgroud)
将其更改为存储:s3立即出错
所以我把它改成了存储:像下面的rdoc所说的雾.
http://rubydoc.info/gems/carrierwave/frames
但是当我尝试上传图片时,我得到了这个疯狂的错误.我正在使用设计宝石.
我的完整堆栈跟踪是
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>", …
Run Code Online (Sandbox Code Playgroud) 我已经生成了预先签名的S3 POST URL.使用返回参数,然后我将它传递给我的代码,但我不断收到此错误Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
.
在Postman上,我可以用一个附件提交表单数据.