我正在使用Carrierwave和Fog将图像存储在云端.我以前使用Amazon S3进行实际存储,没有任何问题.但是我切换到Google云端存储,现在每当我尝试保存任何内容时,我都会收到以下错误:
Excon :: Error ::禁止在GalleriesController中创建
预期(200)<=>实际(403禁止)excon.error.response:body =>"
__CODE__提供的安全凭证无效.请求未签名或包含格式错误的签名":cookies => []:headers => {"Alt-Svc"=>"hq = \":443 \"; ma = 2592000; quic = 51303433; quic = 51303432; quic = 51303431; quic = 51303339; quic = 51303335,quic = \":443 \" ; ma = 2592000; v = \"43,42,39,38,35 \"""Content-Length"=>"224""Content-Type"=>"application/xml; charset = UTF-8""日期"=>"星期二,2018年5月1日22:03:23 GMT""服务器"=>"UploadServer""Vary"=>"Origin""X-GUploader-UploadID"=>"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}:host => "[directory] .storage.googleapis.com":local_address =>"xxx.xxx.x.xxx":local_port => xxxxx:path =>"/ uploads%2Fimage.png":port => 443:reason_phrase => "Forbidden":remote_ip =>"xxx.xxx.x.xx":status => 403:status_line =>"HTTP/1.1 403 Forbidden\r \n"
初始化/ carrierwave.rb
CarrierWave.configure do |config|
config.fog_provider = 'fog/google'
config.fog_credentials = { …Run Code Online (Sandbox Code Playgroud) ruby-on-rails carrierwave fog google-cloud-storage google-cloud-platform