Skip to content

Instantly share code, notes, and snippets.

@gouravtiwari
Last active May 10, 2019 16:40
Show Gist options
  • Save gouravtiwari/bc47aee75a215518ca7e3bfcb03ec6d3 to your computer and use it in GitHub Desktop.
Save gouravtiwari/bc47aee75a215518ca7e3bfcb03ec6d3 to your computer and use it in GitHub Desktop.
Lambda@Edge custom origin
function updateOriginRequest(request) {
request.origin = {
custom: {
domainName: 'some-domain.example.com', // this is the origin where you want to route the request
port: 80, // or 443
protocol: 'http', // http or https
path: '/some-path', // path of the reqest
sslProtocols: ['TLSv1', 'TLSv1.1'], // and any other protocols supported by cloudfront
readTimeout: 10, //readTimeout in seconds,
keepaliveTimeout: 60, // in seconds
customHeaders: {'X-AB-Test': 'A'} // other custom headers
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment