How to Enable IP Geolocation in Cloudflare
Enabling IP Geolocation in Cloudflare lets you identify the country of each visitor by including a country code in all requests. This is useful for analytics, security, and customization based on user location.
Step 1: Log in to Cloudflare Dashboard
- Go to Cloudflare’s login page and enter your account credentials.
- Once logged in, you’ll land on the Cloudflare dashboard.

Step 2: Select Your Domain
- From the dashboard, select the domain where you want to enable IP Geolocation.
Step 3: Go to Network Settings
- In the left sidebar, navigate to Network. This page contains various network-related settings for your domain.

Step 4: Enable IP Geolocation
- Scroll down to find the IP Geolocation setting.
- Toggle the switch On to activate IP Geolocation, which will add the visitor’s country code to each request as a header.

Step 5: Retrieve the Country Code
- When IP Geolocation is enabled, Cloudflare includes the CF-IPCountry HTTP header in each request.
- To use this data, retrieve the CF-IPCountry header in your application or server configuration, which will contain the visitor’s country code (e.g.,
US
for the United States).
That’s it! With IP Geolocation enabled, your site can now detect visitor countries and use this information for custom content, regional analytics, or security adjustments.
Was this article helpful?
YesNo