Created
September 24, 2021 20:23
-
-
Save htnosm/2c51a70f0e361056d1fd63321afba4fa to your computer and use it in GitHub Desktop.
Lambda@Edge origin-request trigger to change HTTP Host Header.
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) => { | |
console.log('event:' + JSON.stringify(event)); | |
// Get contents of request | |
const request = event.Records[0].cf.request; | |
// Rewrite | |
request.headers.host[0].value = '${rewrite_value}'; | |
console.log('request headers:' + JSON.stringify(request.headers)); | |
return callback(null, request); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment