Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blackbing/af573407e1e3905a0fc934239443552c to your computer and use it in GitHub Desktop.
Save blackbing/af573407e1e3905a0fc934239443552c to your computer and use it in GitHub Desktop.
'use strict';
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
const domainHash = headers['x-domain-hash'] && headers['x-domain-hash'][0].value;
if (domainHash) {
request.uri = '/' + domainHash + request.uri;
}
return callback(null, request);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment