If your web server is proxied via cloudflare, you can get request's country code:
Python Flask
country_code = request.headers.get('cf-ipcountry')
Golang Fiber
countryCode := c.Get("cf-ipcountry")
Print out examples:
- US (united states)
- JP (Japan)
- NL (Netherland)
Top comments (0)