Created
June 28, 2018 20:48
-
-
Save DavidWells/99216c20cdb3df334d5b98ff19644fa2 to your computer and use it in GitHub Desktop.
How to do a 301 redirect from an AWS lambda function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = (event, context, callback) => { | |
const response = { | |
statusCode: 301, | |
headers: { | |
Location: 'https://google.com', | |
} | |
}; | |
return callback(null, response); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those using API Gateway + Lambda, I followed this: https://aws.amazon.com/premiumsupport/knowledge-center/malformed-502-api-gateway/
The four fields of statusCode, headers, body, and isBase64Encoded were required