I have a Cloudfront distribution with a custom origin.
I want to use a Lambda@Edge Origin Request to modify and add some extra headers to be forwarded to my origin server.
Below is my Lambda function. The custom_header
is visible in Cloudwatch logs for my Lambda, but doesn't show up in my custom server request headers :(.
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
headers['custom_header'] = [{ key: 'custom_header', value: 'custom_header' }];
return callback(null, request);
}
I expect custom_header
to be visible in my Node.js route under req.headers
.