I'm currently using a lambda to created signed links for my s3 bucket, and these links are supposed to have an expiry time of 24 hours. However, when I check the returned link - all the expiry times are set to 15 minutes. I've changed the CORS configuration on the s3 server to 86400 (24 hours), but that hasn't seemed to have fixed it. The file retrieval works perfectly fine though.
I'm using the javascript s3 sdk for doing this, below is the piece of code that creates the signed url. What can I do to make it accept the expires time?
var EXPIRY_IN_SECONDS = 3600 * 24; // 24 hour
function createSignedDownloadUrl(options, callback) {
if (!options || !options.fileName ) {
return callback(new Error('Invalid input.'));
}
var containsSpecialChars = /[^\u0000-\u00ff]/g.test(options.fileName);
var contentDisposition;
if (containsSpecialChars) {
contentDisposition = 'inline; filename*=UTF-8\'\''+ encodeURIComponent(options.fileName);
} else {
contentDisposition = 'inline; filename="'+ options.fileName + '"; filename*=UTF-8\'\''+ encodeURIComponent(options.fileName);
}
var getObjectParams = {
Bucket: options.s3Bucket,
Key: options.s3Key,
Expires: EXPIRY_IN_SECONDS,
ResponseContentDisposition: contentDisposition,
};
s3.getSignedUrl('getObject', getObjectParams, callback);
}