Created
May 11, 2019 17:29
-
-
Save maheee/6e6f07c661e8785f0c2e33ea17c07965 to your computer and use it in GitHub Desktop.
lambda redirect
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) => { | |
var request = event.Records[0].cf.request; | |
var olduri = request.uri; | |
var newuri = olduri; | |
newuri = newuri.replace(/^\/$/, '\/index.html'); | |
newuri = newuri.replace(/^\/dashboard\/$/, '\/dashboard\/dash.html'); | |
console.log("Old URI: " + olduri); | |
console.log("New URI: " + newuri); | |
request.uri = newuri; | |
return callback(null, request); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment