Open
Description
hi guys, my use case is if the response is 404 from S3, to redirect to the original source to create it.
currently if I do
function handler(event) {
var response = event.response;
if (response.statusCode == '404') {
var newResponse = {
statusCode: 302,
statusDescription: 'Found',
headers:{
"location": { "value": "https://alternative-cdn-cname.com/path-to-regenerate-asset/" }
}
}
}
return newResponse;
}
on the response I get
502 ERROR
The request could not be satisfied.
The CloudFront function tried to add, delete, or change a read-only header.
- is there a way to create a redirect (edit location header) on the response?
- can lambda solve this?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels