dimanche 6 septembre 2015

How to force download on a signed URL for an image from amazon s3

I have a SPA javascript app that serves files. I show users a download button, I call my API to see if they have permissions, if so, i create a signed URL in amazon from my Ruby API and feed it into my JS app.

I notice that when I do the same for a zip file, I can call window.location.href = "/file.zip" and it just downloads.

When I create the signed URL, is there any way I can tell amazon not to open the file in a web browser?

Using the AWS lib I'm currently doing the following:

signer = Aws::S3::Presigner.new
signer.presigned_url(:get_object, 
                     bucket: WEB_BUCKET, 
                     key: key
                    )




Aucun commentaire:

Enregistrer un commentaire