Creating a signed S3 URL with Javascript


I am attempting to create a signed S3 URL using Javascript & NodeJS. I have used this

This creates a url similar to this:

However, I receive the following error when accessing it:

What am I doing wrong when creating the signature?


I am now attempting to use Knox to produce a signed URL. I need to add headers with the request to force download. I have edited the following:

Added amazonHeaders: 'response-content-disposition:attachment', to client.signedUrl-

Added options.amazonHeaders + '\n' + to auth.queryStringToSign

The message that is now being sent to auth.hmacSha1 to create the the sig is:

I have then tried to access my new URL with the response-content-disposition=attachment added as GET var. However, I am still receiving the same error stated above.


I would try using Knox along with Node.Js . Its known to be a great combination and also itself utilizes the Node.JS Crypto library which is kind of what you’re trying to do – saving you time:)

More info here :

Than, you could just do something like:

You could also look into Knox and just check what the signedUrl function does and implement that yourself.Than you could add to the auth.signQuery call an extra option called amazonHeaders:


Leave a Reply