{"id":1628,"date":"2020-06-07T22:31:53","date_gmt":"2020-06-07T14:31:53","guid":{"rendered":"https:\/\/www.wesbytes.com\/guide\/?post_type=kb&#038;p=1628"},"modified":"2026-03-26T13:03:59","modified_gmt":"2026-03-26T05:03:59","slug":"what-cloudflare-ip-geolocation-do","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/what-cloudflare-ip-geolocation-do","title":{"rendered":"Top 5 Advantages of Cloudflare IP Geolocation for Your Website"},"content":{"rendered":"<h3><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/cdn.prod.website-files.com\/5e6a84f09b62b91e6157c149\/5e6a8dd88f50f50f9ef987f1_5e37b64f7c077b4c62ef76a2_shutterstock_1363873922.jpeg\" alt=\"Cloudflare IP Geolocation\" width=\"1000\" height=\"666\" \/><\/h3>\n<h3>What does Cloudflare IP Geolocation do?<\/h3>\n<p>You can enable IP Geolocation to have <a href=\"https:\/\/www.cloudflare.com\/\" rel=\"nofollow noopener\" target=\"_blank\">Cloudflare<\/a> geolocate visitors to your website and pass the country code to you in ISO 3166-1 Alpha 2 format.<\/p>\n<p>You will find the IP Geolocation option under the\u00a0<strong>Network<\/strong>\u00a0app in the Cloudflare dashboard.<\/p>\n<p>The option for IP geolocation will be found near the bottom of the page:<\/p>\n<p>Once enabled, Cloudflare adds a header called \u201cCF-IPCountry\u201d to all requests we make to your website. Here are a couple of examples of how to access\/store this value:<\/p>\n<pre>$country_code = $_SERVER[\"HTTP_CF_IPCOUNTRY\"]; \/\/ to access in PHP<\/pre>\n<pre>$country_code = $ENV{\"HTTP_CF_IPCOUNTRY\"}; # to access in Perl<\/pre>\n<p>Cloudflare includes this information for both IPv4 and IPv6 addresses. Currently, the IPv4 information is more robust, but we expect the IPv6 data to improve rapidly.<\/p>\n<p><em>If it is XX<\/em>\u00a0means there is no country data. T1 is a non-standard country code used for the Tor <a href=\"https:\/\/www.servergigabit.com\/\">network.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What does Cloudflare IP Geolocation do? You can enable IP Geolocation to have Cloudflare geolocate visitors to your website and pass the country code to you in ISO 3166-1 Alpha 2 format. You will find the IP Geolocation option under the\u00a0Network\u00a0app in the Cloudflare dashboard. The option for IP geolocation will be found near the bottom of the page: Once&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[43],"kbtag":[1124,1404],"class_list":["post-1628","kb","type-kb","status-publish","hentry","kbtopic-cloudflare","kbtag-cloudflare","kbtag-ip-geolocation"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=1628"}],"version-history":[{"count":5,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1628\/revisions"}],"predecessor-version":[{"id":6411,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1628\/revisions\/6411"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=1628"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=1628"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=1628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}