diff --git a/lib/fog/aws/requests/storage/get_object_url.rb b/lib/fog/aws/requests/storage/get_object_url.rb index ff0f09b54..f3ac626d5 100644 --- a/lib/fog/aws/requests/storage/get_object_url.rb +++ b/lib/fog/aws/requests/storage/get_object_url.rb @@ -23,9 +23,9 @@ module Fog end url({ :headers => {}, - :host => "#{bucket_name}.#{@host}", + :host => @host, :method => 'GET', - :path => CGI.escape(object_name) + :path => [bucket_name, CGI.escape(object_name)].join('/') }, expires) end @@ -42,9 +42,9 @@ module Fog end url({ :headers => {}, - :host => "#{bucket_name}.#{@host}", + :host => @host, :method => 'GET', - :path => CGI.escape(object_name) + :path => [bucket_name, CGI.escape(object_name)].join('/') }, expires) end diff --git a/lib/fog/aws/requests/storage/put_object_url.rb b/lib/fog/aws/requests/storage/put_object_url.rb index 75031768d..aadefa7b8 100644 --- a/lib/fog/aws/requests/storage/put_object_url.rb +++ b/lib/fog/aws/requests/storage/put_object_url.rb @@ -23,9 +23,9 @@ module Fog end url({ :headers => {}, - :host => "#{bucket_name}.#{@host}", + :host => @host, :method => 'PUT', - :path => CGI.escape(object_name) + :path => [bucket_name, CGI.escape(object_name)].join('/') }, expires) end @@ -42,9 +42,9 @@ module Fog end url({ :headers => {}, - :host => "#{bucket_name}.#{@host}", + :host => @host, :method => 'PUT', - :path => CGI.escape(object_name) + :path => [bucket_name, CGI.escape(object_name)].join('/') }, expires) end diff --git a/lib/fog/aws/storage.rb b/lib/fog/aws/storage.rb index a51fc85f0..909b68d87 100644 --- a/lib/fog/aws/storage.rb +++ b/lib/fog/aws/storage.rb @@ -64,7 +64,8 @@ module Fog query << "AWSAccessKeyId=#{@aws_access_key_id}" query << "Signature=#{CGI.escape(signature(params))}" query << "Expires=#{params[:headers]['Date']}" - "http://#{params[:host]}/#{params[:path]}?#{query.join('&')}" + bucket = params[:host].split('.').first + "https://#{@host}/#{params[:path]}?#{query.join('&')}" end end