I want to redirect cloud-front lambda@edge through redirect my s3 bucket signed url.
exports.handler = async(event, context, callback) => {
console.log(JSON.stringify(event));
const request = event.Records[0].cf.request;
let path = request.uri.substring(1);
let bucket = "bucket name";
const url = s3.getSignedUrl("getObject", {
Bucket: bucket,
Key: path,
Expires: 20 * 60, //time to expire in seconds - 20 min
});
console.log(url);
//here which code apply to redirect to signedurl s3
callback(null, request);
}
I have private file in my s3 that bucket connected through cloud-front.
then we set lambda edge on
Event type: origin-request
but now i face issue. I don't know how to i redirect new generated signed request in s3 from lambda edge.