I'm trying to make a private object on a static website hosted S3 bucket which is accessible from a signed URL. Seems simple enough, however using the following code with virtual_host
enabled seems to always result in a 403 Forbidden. If I disable virtual_host
then it works as expected.
url = Aws::S3::Presigner.new.presigned_url(
:get_object,
:bucket => BUCKET,
:key => KEY,
:virtual_host => true
)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
resp = http.request(request)
puts resp.body
Is there a permissions/setting that is missing to make this work?