Accessing cloudfront-viewer-country header in AWS API Gateway using HTTP Proxy?

Viewed 3791

I'm using AWS API Gateway and its HTTP Proxy.

I need to pass the CloudFront-Viewer-Country header to my endpoint. I tried following the same setup outlined in the following question Access headers in AWS API Gateway using HTTP Proxy?

and I'm getting the following headers on my endpoint server.

Array
(
    [host] => example.com
    [Accept] => application/json
    [User-Agent] => AmazonAPIGateway_c8752844lh
    [x-amzn-apigateway-api-id] => c8752844lh
    [X-Amzn-Trace-Id] => Root=1-59bd7a5e-003ef07b3c4c3680299801f1
    [X-Forwarded-For] => xx.xxx.xx.xxx
    [X-Forwarded-Port] => 443
    [X-Forwarded-Proto] => https
    [Connection] => keep-alive

)

However, the CloudFront-Viewer-Country is not among them. If I used a lambda function instead of HTTP Proxy, I can see a lot more headers (including the CloudFront-Viewer-Country).

Could anyone please tell me how to access the required header on my endpoint using HTTP Proxy ?

2 Answers
Related