I'm using knox module to https://github.com/LearnBoost/knox to create signed URLs for files on S3, something I've done with PHP SDK before.
I can delete files from开发者_如何学运维 my bucket, but I'm getting SignatureDoesNotMatch error when I try the generated URLs for files with private ACL.
Code looks like this
var knox = require('knox');
var s3Client = knox.createClient({
key: '*****',
secret: '*****',
bucket: '*****'
});
function getS3Url(filename) {
var expires = new Date();
expires.setMinutes(expires.getMinutes() + 30);
return s3Client.signedUrl(filename, expires);
}
console.log(getS3Url('file.txt'));
What am I doing wrong?
Turns out I was missing the leading '/' on filename, signature matches now.
精彩评论