如何获取客户端请求的 CloudFront 端点国家/地区?

How to get the CloudFront endpoint country of a client request?

我的网站托管在 S3 中,CloudFront 分发指向它。

在我的网站中,我需要知道对我网站的请求来自哪个国家/地区。

CloudFront 是否可以根据 CloudFront 端点位置将此信息添加到请求中,可能是 header 左右?

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html

If you want CloudFront to cache different versions of your objects based on the country that the request came from, configure CloudFront to forward the CloudFront-Viewer-Country header to your origin. CloudFront automatically converts the IP address that the request came from into a two-letter country code. For an easy-to-use list of country codes, sortable by code and by country name, see the Wikipedia entry ISO 3166-1 alpha-2.