Configuration

Enable Cloudflare headers

Configure Cloudflare and your self-hosted reverse proxy to pass visitor location headers to Umami so it can record region and city data.

This guide applies to self-hosted Umami when analytics collection requests pass through Cloudflare to your Umami server. Enabling Cloudflare on the tracked website alone does not send its location headers with separate analytics requests.

For Umami Cloud, see IP handling and reverse proxies. Cloud manages its collection infrastructure; the Nginx configuration and runtime variables below are not Cloud account settings.

Umami can use Cloudflare-provided country, region, and city headers. Cloudflare's Add visitor location headers transform supplies additional location information.

Steps#

  1. Log in to the Cloudflare dashboard and select your account and website.

  2. Go to Rules > Settings.

  3. Go to the Managed Transforms tab.

  4. Enable the Add visitor location headers setting.

Then, you'll have to proxy the following headers to Umami:

  • CF-IPCountry
  • CF-Region-Code
  • CF-IPCity

Only forward these headers from a trusted Cloudflare connection, and restrict access to the origin so clients cannot bypass that trusted proxy and supply their own headers.

For example, if you're using Nginx as a reverse proxy, you can add the following configuration:

Force local geo database#

Alternatively, when Cloudflare sends only the country but adding the visitor location headers is not possible, you can set the SKIP_LOCATION_HEADERS runtime variable to 1. This disables header detection and forces the usage of the internal geo database for region and city resolution.

The local database uses the IP available to Umami. It cannot recover an original visitor IP removed or anonymized by a proxy, and region or city data may be unavailable. See location metrics for accuracy limits and the distinction between analytics records and operational logs.