Skip to content

Instantly share code, notes, and snippets.

@anuraagdjain
Forked from DavidWells/aws-lambda-redirect.js
Created October 1, 2020 20:35
Show Gist options
  • Save anuraagdjain/2be2d3e55e6d85b381f2de0ba0cde485 to your computer and use it in GitHub Desktop.
Save anuraagdjain/2be2d3e55e6d85b381f2de0ba0cde485 to your computer and use it in GitHub Desktop.
How to do a 301 redirect from an AWS lambda function
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