Created
October 18, 2019 05:38
-
-
Save tacck/ec20af4c6ae28081a11c1eac60af4524 to your computer and use it in GitHub Desktop.
Rewrite on Lambda@Edge
This file contains hidden or 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
'use strict'; | |
exports.handler = (event, context, callback) => { | |
const request = event.Records[0].cf.request; | |
const regex = /.*\/$/; | |
const result = request.uri.match(regex); | |
if (result !== null) { | |
request.uri += 'index.html'; | |
} | |
callback(null, request); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment