IP Geolocation using Cloudflare

Cloudflare offers a neat feature for free to capture the country code of visitors hitting your web server. This can be useful for many different applications.

For example, if you would like to offer discounts to customers from other countries, block certain countries from accessing your website, or even block users on the Tor network.

IP Geolocation in Cloudflare is enabled in the Network tab of your Cloudflare dashboard. The country code is visible in the CF-IPCountry header in the ISO 3166-1 Alpha 2 format. Check out the official guide here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.