Skip to content

Matomo behind cloudflared

Why

When running Matomo (FKA Piwiki) behind Cloudflare in Proxy mode, or using cloudflared the IP address isn't always the Public IP address of the user, but instead the edge node of Cloudflare

An example is below

Solution

Edit the config.ini.php file and add the below under [General]

[General]
proxy_client_headers[] = "HTTP_CF_CONNECTING_IP"
proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_host_headers[] = "HTTP_X_FORWARDED_HOST"

If you're doing this on Kubernetes, then you need to have a PVC set up for this, as we cant set environment variables for lists


Want to make this site better? Open a PR or help fund hosting costs