1 Answer
- Newest
- Most votes
- Most comments
0
Yes. X-Forwarded-For Header can be manipulate.
So, You can use Lambda@Edge for origin request phase to overwrite X-Forwarded-For header or create other header like True-Client-IP.
Simple example is below.
'use strict';
exports.handler = function(event, context, callback) {
var request = event.Records[0].cf.request;
request.headers["true-client-ip"] = [{"key":"True-Client-IP","value":request.clientIp}]
request.headers["x-forwarded-for"] = [{"key":"X-Forwarded-For","value":request.clientIp}]
callback(null, request);
};
please check other L@E samples below. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-examples.html
answered 4 years ago
Relevant content
- Accepted Answerasked 4 months ago
- asked 4 months ago
- asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago