From 759c21fff07fb531ab7fde770f0b19d0dd88be10 Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Tue, 11 Feb 2020 10:52:59 +0200 Subject: [PATCH] Use cloudflare header for fingerprint --- lib/plausible_web/controllers/api/external_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plausible_web/controllers/api/external_controller.ex b/lib/plausible_web/controllers/api/external_controller.ex index 616feccb0..fc00b056b 100644 --- a/lib/plausible_web/controllers/api/external_controller.ex +++ b/lib/plausible_web/controllers/api/external_controller.ex @@ -79,7 +79,7 @@ defmodule PlausibleWeb.Api.ExternalController do defp calculate_raw_fingerprint(conn, params) do user_agent = List.first(Plug.Conn.get_req_header(conn, "user-agent")) || "" - ip_address = to_string(:inet_parse.ntoa(conn.remote_ip)) || "" + ip_address = List.first(Plug.Conn.get_req_header(conn, "cf-connecting-ip")) || "" domain = strip_www(params["domain"]) || "" Enum.join([user_agent, ip_address, domain], ":") end