Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blackbing/a2463f3523c19e5ec8b9c201f49b304b to your computer and use it in GitHub Desktop.
Save blackbing/a2463f3523c19e5ec8b9c201f49b304b to your computer and use it in GitHub Desktop.
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
const host = headers.host[0].value;
const hash = /([0-9a-z-]+)\.m\.verybuy\.io/.exec(host)
if (hash && hash[1]) {
headers['X-Domain-Hash'] = [{
key: "X-Domain-Hash",
value: hash[1],
}];
}
callback(null, request);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment