Skip to content

Instantly share code, notes, and snippets.

@vipin87
Last active March 2, 2021 07:49
Show Gist options
  • Save vipin87/f0532a9b416b6fd8f3b5eef71c1024ff to your computer and use it in GitHub Desktop.
Save vipin87/f0532a9b416b6fd8f3b5eef71c1024ff to your computer and use it in GitHub Desktop.
'use strict';
exports.handler = (event, context, callback) => {
console.log(JSON.stringify(event.Records[0].cf));
var request = event.Records[0].cf.request
var host = request.headers.host[0].value;
var uri = request.uri;
request.uri = '/' + host + uri;
console.log('new uri', request.uri)
// Return to CloudFront
return callback(null, request);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment