We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Thanks.
The text was updated successfully, but these errors were encountered:
I have this same problem!
Sorry, something went wrong.
Could you achieve this using custom error responses to respond with an HTML file that has a <meta http-equiv="refresh"> redirect?
<meta http-equiv="refresh">
The original code seems to be incorrect. It returns newResponse but if the original status code is != 404, newResponse is not set.
newResponse
No branches or pull requests
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
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.
Thanks.
The text was updated successfully, but these errors were encountered: