Skip to content

Instantly share code, notes, and snippets.

@tacck
Created October 18, 2019 05:38
Show Gist options
  • Save tacck/ec20af4c6ae28081a11c1eac60af4524 to your computer and use it in GitHub Desktop.
Save tacck/ec20af4c6ae28081a11c1eac60af4524 to your computer and use it in GitHub Desktop.
Rewrite on Lambda@Edge
'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