aws-samples / amazon-cloudfront-functions

Apache License 2.0
479 stars 78 forks source link

Unable to get clientIP #28

Closed nagendrakumar02 closed 2 years ago

nagendrakumar02 commented 2 years ago

I am using the example "Add true clientIP to request". I have followed the example and deployed a cloudfront example but I am not able to see the ip as part of the request.

function handler(event) { var request = event.request; var clientIP = event.viewer.ip;

console.log("test");
//Add the true-client-ip header to the incoming request
request.headers['true-client-ip'] = {value: clientIP};

return request;

}

image
nagendrakumar02 commented 2 years ago

I was able to fix this