Giter Club home page Giter Club logo

Comments (23)

ruslandoga avatar ruslandoga commented on June 21, 2024

👋 @viriatusX

The last time I tried cf workers, everything was working as expected: #2137 (comment)

Could you please share more of your setup?

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

Hi @ruslandoga

All statistics are displayed correctly, except the Map with the country / region / city of the visitors. It does not show anything.
When I deactivate the Worker, everything works perfectly.

I have Plausible with Nginx Proxy Manager (without additional HTTP headers.
I have the Plausible domain as "Proxied".
I have tried with Plausible remote:
iex> Plausible.Geo.lookup("1.1.1.1.1")
And it shows the country and everything ok.

The problem is that it is not reflected in the UI.

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

Would you be able to share your configuration files, including nginx, worker scripts, and anything else that seems relevant?

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

You can also trace the incoming request to see what headers are included with recon_trace. There have been several discussions where it helped resolve IP geo location issues. #3248 (comment) #2767 (reply in thread) etc. (you can search for others using parts of that code snippet)

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

I have executed this inside Plausible remote. But I don't know how to check it with my domain. Sorry.

iex> headers = fn {:trace, _pid, :call, {_mod, _fun, [%Plug.Conn{req_headers: headers}]}} -> inspect(headers) end
iex> mod_fun_args = {PlausibleWeb.RemoteIp, :get, 1}
iex> how_many_times = 5
iex> :recon_trace.calls(mod_fun_args, how_many_times, formatter: headers)

My Worker Script is the same of yours (changing only my domain).

My Nginx conf for the Plausible domain:

# ------------------------------------------------------------
# stats.xxxxx.com
# ------------------------------------------------------------


server {
  set $forward_scheme http;
  set $server         "192.168.10.165";
  set $port           3998;

  listen 80;
listen [::]:80;

listen 443 ssl http2;
listen [::]:443 ssl http2;


  server_name xxxxx.com;


  # Let's Encrypt SSL
  include conf.d/include/letsencrypt-acme-challenge.conf;
  include conf.d/include/ssl-ciphers.conf;
  ssl_certificate /etc/letsencrypt/live/npm-23/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/npm-23/privkey.pem;


proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;

  access_log /data/logs/proxy-host-15_access.log proxy;
  error_log /data/logs/proxy-host-15_error.log warn;


  location / {

    
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;
    

    # Proxy!
    include conf.d/include/proxy.conf;
  }


  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

I execute Plausible GeoIP command with this IP, but in the UI not appear... with Workers enabled.

Captura de pantalla 2024-04-04 a las 23 18 26 Captura de pantalla 2024-04-04 a las 23 18 34

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

Ant the output for this command (in case it helps.)

Captura de pantalla 2024-04-04 a las 23 20 27

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

I have executed this inside Plausible remote. But I don't know how to check it with my domain. Sorry.

You would need to visit your site which would make an /api/event call. The traces would be printed in the console. Ideally, you'd run it both when the Worker is activated and when it's not.

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

All statistics are displayed correctly, except the Map with the country / region / city of the visitors. It does not show anything.
When I deactivate the Worker, everything works perfectly.

I've re-read this now, and it's not clear what exactly is wrong, is the map empty or not displayed at all? Can you show screenshot for when the Worker is activated and when it's not?

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

If I access with an IP from Portugal:

With Worker

Captura de pantalla 20

Without Worker

Captura de pantalla 2024-04-05 a las 11 37 17

The map is not updated. The rest of the statistics work OK. If it was a /api/event problem, I think it would not show any statistics.

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

Great, then #3976 (comment) should help resolve it. Most likely, the X-Forwarded-For header or similar is dropped somewhere along the way. You can also trace Plausible.Geo.lookup to see what exact IP address is used for the lookup of your Portugal request and what info it gets in return.

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

Great, then #3976 (comment) should help resolve it. Most likely, the X-Forwarded-For header or similar is dropped somewhere along the way. You can also trace Plausible.Geo.lookup to see what exact IP address is used for the lookup of your Portugal request and what info it gets in return.

Thanks for your help.
Forgive my clumsiness. I have executed this, but then I don't know how to continue.

iex> headers = fn {:trace, _pid, :call, {_mod, _fun, [%Plug.Conn{req_headers: headers}]}} -> inspect(headers) end
iex> mod_fun_args = {PlausibleWeb.RemoteIp, :get, 1}
iex> how_many_times = 5
iex> :recon_trace.calls(mod_fun_args, how_many_times, formatter: headers)

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

I have executed this, but then I don't know how to continue.

You would need to visit https://hdsplus.co after you run these commands. The traces would be printed in the console. Ideally, you'd run it both when the Worker is activated and when it's not.

You can check the previous discussions I linked for more info :) E.g. #2767 (reply in thread)

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

Sorry, on which console do I view the trace? The Plausible console does not show anything new.

  1. I execute these commands
  2. I access to my Web with Chrome and Safari
Captura de pantalla 2024-04-05 a las 12 04 43

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

If it doesn't show anything, then there are no requests reaching Plausible. Try running it with the Worker deactivated.

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

Neither... The Plausible remote console does not show anything new after executing these commands.
And without Worker everything works fine. Strange.

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

Ok, I see. I guess you are on v2.1.0-rc.0? The module name changed from RemoteIp to RemoteIP in #3761. Please run this command instead :recon_trace.calls({PlausibleWeb.RemoteIP, :get, 1}, 10)

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

Thanks! now yes!

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

Please post the traces as code or text snippet. It would be easier to debug.

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

With Worker OFF

10:51:03.834035 <0.10238.0> 'Elixir.PlausibleWeb.RemoteIP':get(#{owner=><0.10238.0>, port=>80, private=>#{'Elixir.PlausibleWeb.Router'=>[], phoenix_view=>#{'_'=>'Elixir.PlausibleWeb.Api.ExternalView'}, plug_session_fetch=>done, plug_session=>#{}, before_send=>[#Fun<Elixir.Plug.Session.0.76384852>,#Fun<Elixir.Plug.Telemetry.0.54455629>], phoenix_endpoint=>'Elixir.PlausibleWeb.Endpoint', phoenix_action=>event, phoenix_layout=>#{'_'=>{'Elixir.PlausibleWeb.LayoutView',app}}, phoenix_controller=>'Elixir.PlausibleWeb.Api.ExternalController', phoenix_format=><<"json">>, phoenix_router=>'Elixir.PlausibleWeb.Router'}, scheme=>http, status=>nil, script_name=>[], state=>unset, host=><<"stats.hdsplus.co">>, cookies=>#{}, params=>#{}, '__struct__'=>'Elixir.Plug.Conn', halted=>false, assigns=>#{}, method=><<"POST">>, adapter=>{'Elixir.Plug.Cowboy.Conn',#{pid => <0.10237.0>,port => 80,
                             scheme => <<"http">>,version => 'HTTP/1.1',
                             path => <<"/api/event">>,
                             host => <<"stats.hdsplus.co">>,
                             peer => {{192,168,144,1},59938},
                             sock => {{192,168,144,2},8000},
                             bindings => #{},
                             ref => 'Elixir.PlausibleWeb.Endpoint.HTTP',
                             cert => undefined,
                             headers =>
                                 #{<<"accept">> => <<"*/*">>,
                                   <<"accept-encoding">> => <<"gzip, br">>,
                                   <<"accept-language">> =>
                                       <<"es-ES,es;q=0.9,en;q=0.8,ca;q=0.7,zh-CN;q=0.6,zh;q=0.5">>,
                                   <<"cdn-loop">> => <<"cloudflare">>,
                                   <<"cf-ipcontinent">> => <<"EU">>,
                                   <<"cf-ipcountry">> => <<"ES">>,
                                   <<"cf-iplatitude">> => <<"41.39490">>,
                                   <<"cf-iplongitude">> => <<"2.17560">>,
                                   <<"cf-ray">> => <<"86f8fb147d571511-MAD">>,
                                   <<"cf-region">> => <<"Catalonia">>,
                                   <<"cf-region-code">> => <<"CT">>,
                                   <<"cf-timezone">> => <<"Europe/Madrid">>,
                                   <<"cf-visitor">> =>
                                       <<"{\"scheme\":\"https\"}">>,
                                   <<"content-length">> => <<"74">>,
                                   <<"content-type">> => <<"text/plain">>,
                                   <<"host">> => <<"stats.hdsplus.co">>,
                                   <<"origin">> => <<"https://hdsplus.co">>,
                                   <<"priority">> => <<"u=1, i">>,
                                   <<"referer">> => <<"https://hdsplus.co/">>,
                                   <<"sec-ch-ua">> =>
                                       <<"\"Google Chrome\";v=\"123\", \"Not:A-Brand\";v=\"8\", \"Chromium\";v=\"123\"">>,
                                   <<"sec-ch-ua-mobile">> => <<"?0">>,
                                   <<"sec-ch-ua-platform">> => <<"\"macOS\"">>,
                                   <<"sec-fetch-dest">> => <<"empty">>,
                                   <<"sec-fetch-mode">> => <<"cors">>,
                                   <<"sec-fetch-site">> => <<"same-site">>,
                                   <<"user-agent">> =>
                                       <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36">>,
                                   <<"x-forwarded-for">> =>
                                       <<"83.44.134.248, 188.114.111.124">>,
                                   <<"x-forwarded-proto">> => <<"https">>,
                                   <<"x-forwarded-scheme">> => <<"https">>,
                                   <<"x-real-ip">> => <<"188.114.111.124">>},
                             method => <<"POST">>,qs => <<>>,
                             path_info => undefined,streamid => 1,
                             body_length => 74,has_body => true,
                             host_info => undefined}}, secret_key_base=><<"jMI5V6xYzyfwHSHhYnluvqHKa69CdX7XOyKeh925wAOrpaq7yaZLQEovqh2mJJrbnuXSGZ0k0rHY0VxaQ4Q//w==">>, body_params=>#{'__struct__'=>'Elixir.Plug.Conn.Unfetched', aspect=>body_params}, path_info=>[<<"api">>,<<"event">>], path_params=>#{}, query_params=>#{}, query_string=><<>>, remote_ip=>{192,168,144,1}, req_cookies=>#{}, req_headers=>[{<<"accept">>,<<"*/*">>},
 {<<"accept-encoding">>,<<"gzip, br">>},
 {<<"accept-language">>,
  <<"es-ES,es;q=0.9,en;q=0.8,ca;q=0.7,zh-CN;q=0.6,zh;q=0.5">>},
 {<<"cdn-loop">>,<<"cloudflare">>},
 {<<"cf-ipcontinent">>,<<"EU">>},
 {<<"cf-ipcountry">>,<<"ES">>},
 {<<"cf-iplatitude">>,<<"41.39490">>},
 {<<"cf-iplongitude">>,<<"2.17560">>},
 {<<"cf-ray">>,<<"86f8fb147d571511-MAD">>},
 {<<"cf-region">>,<<"Catalonia">>},
 {<<"cf-region-code">>,<<"CT">>},
 {<<"cf-timezone">>,<<"Europe/Madrid">>},
 {<<"cf-visitor">>,<<"{\"scheme\":\"https\"}">>},
 {<<"content-length">>,<<"74">>},
 {<<"content-type">>,<<"text/plain">>},
 {<<"host">>,<<"stats.hdsplus.co">>},
 {<<"origin">>,<<"https://hdsplus.co">>},
 {<<"priority">>,<<"u=1, i">>},
 {<<"referer">>,<<"https://hdsplus.co/">>},
 {<<"sec-ch-ua">>,
  <<"\"Google Chrome\";v=\"123\", \"Not:A-Brand\";v=\"8\", \"Chromium\";v=\"123\"">>},
 {<<"sec-ch-ua-mobile">>,<<"?0">>},
 {<<"sec-ch-ua-platform">>,<<"\"macOS\"">>},
 {<<"sec-fetch-dest">>,<<"empty">>},
 {<<"sec-fetch-mode">>,<<"cors">>},
 {<<"sec-fetch-site">>,<<"same-site">>},
 {<<"user-agent">>,
  <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36">>},
 {<<"x-forwarded-for">>,<<"83.44.134.248, 188.114.111.124">>},
 {<<"x-forwarded-proto">>,<<"https">>},
 {<<"x-forwarded-scheme">>,<<"https">>},
 {<<"x-real-ip">>,<<"188.114.111.124">>}], request_path=><<"/api/event">>, resp_body=>nil, resp_cookies=>#{}, resp_headers=>[{<<"cache-control">>,<<"max-age=0, private, must-revalidate">>},
 {<<"x-request-id">>,<<"F8NcwC-h5A2dSpEAAOWC">>},
 {<<"access-control-allow-credentials">>,<<"true">>},
 {<<"access-control-allow-origin">>,<<"*">>},
 {<<"access-control-expose-headers">>,<<>>}]})

With Worker ON

10:49:58.276958 <0.10200.0> 'Elixir.PlausibleWeb.RemoteIP':get(#{owner=><0.10200.0>, port=>80, private=>#{'Elixir.PlausibleWeb.Router'=>[], phoenix_view=>#{'_'=>'Elixir.PlausibleWeb.Api.ExternalView'}, plug_session_fetch=>done, plug_session=>#{}, before_send=>[#Fun<Elixir.Plug.Session.0.76384852>,#Fun<Elixir.Plug.Telemetry.0.54455629>], phoenix_endpoint=>'Elixir.PlausibleWeb.Endpoint', phoenix_action=>event, phoenix_layout=>#{'_'=>{'Elixir.PlausibleWeb.LayoutView',app}}, phoenix_controller=>'Elixir.PlausibleWeb.Api.ExternalController', phoenix_format=><<"json">>, phoenix_router=>'Elixir.PlausibleWeb.Router'}, scheme=>http, status=>nil, script_name=>[], state=>unset, host=><<"stats.hdsplus.co">>, cookies=>#{}, params=>#{}, '__struct__'=>'Elixir.Plug.Conn', halted=>false, assigns=>#{}, method=><<"POST">>, adapter=>{'Elixir.Plug.Cowboy.Conn',#{pid => <0.10199.0>,port => 80,
                             scheme => <<"http">>,version => 'HTTP/1.1',
                             path => <<"/api/event">>,
                             host => <<"stats.hdsplus.co">>,
                             peer => {{192,168,144,1},54410},
                             sock => {{192,168,144,2},8000},
                             bindings => #{},
                             ref => 'Elixir.PlausibleWeb.Endpoint.HTTP',
                             cert => undefined,
                             headers =>
                                 #{<<"accept">> => <<"*/*">>,
                                   <<"accept-encoding">> => <<"gzip">>,
                                   <<"accept-language">> =>
                                       <<"es-ES,es;q=0.9">>,
                                   <<"cdn-loop">> =>
                                       <<"cloudflare; subreqs=1">>,
                                   <<"cf-ew-via">> => <<"15">>,
                                   <<"cf-ipcity">> => <<"El Astillero">>,
                                   <<"cf-ipcontinent">> => <<"EU">>,
                                   <<"cf-ipcountry">> => <<"ES">>,
                                   <<"cf-iplatitude">> => <<"43.40160">>,
                                   <<"cf-iplongitude">> => <<"-3.81530">>,
                                   <<"cf-postal-code">> => <<"39610">>,
                                   <<"cf-ray">> => <<"86f8f97ad3bb69eb-MAD">>,
                                   <<"cf-region">> => <<"Cantabria">>,
                                   <<"cf-region-code">> => <<"CB">>,
                                   <<"cf-timezone">> => <<"Europe/Madrid">>,
                                   <<"cf-visitor">> =>
                                       <<"{\"scheme\":\"https\"}">>,
                                   <<"cf-worker">> =>
                                       <<"hdsplus.workers.dev">>,
                                   <<"content-length">> => <<"125">>,
                                   <<"content-type">> => <<"text/plain">>,
                                   <<"host">> => <<"stats.hdsplus.co">>,
                                   <<"origin">> => <<"https://hdsplus.co">>,
                                   <<"priority">> => <<"u=3, i">>,
                                   <<"referer">> => <<"https://hdsplus.co/">>,
                                   <<"sec-fetch-dest">> => <<"empty">>,
                                   <<"sec-fetch-mode">> => <<"cors">>,
                                   <<"sec-fetch-site">> => <<"cross-site">>,
                                   <<"user-agent">> =>
                                       <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15">>,
                                   <<"x-forwarded-for">> =>
                                       <<"2a06:98c0:3600::103, 172.70.57.158">>,
                                   <<"x-forwarded-proto">> => <<"https">>,
                                   <<"x-forwarded-scheme">> => <<"https">>,
                                   <<"x-real-ip">> => <<"172.70.57.158">>},
                             method => <<"POST">>,qs => <<>>,
                             path_info => undefined,streamid => 1,
                             body_length => 125,has_body => true,
                             host_info => undefined}}, secret_key_base=><<"jMI5V6xYzyfwHSHhYnluvqHKa69CdX7XOyKeh925wAOrpaq7yaZLQEovqh2mJJrbnuXSGZ0k0rHY0VxaQ4Q//w==">>, body_params=>#{'__struct__'=>'Elixir.Plug.Conn.Unfetched', aspect=>body_params}, path_info=>[<<"api">>,<<"event">>], path_params=>#{}, query_params=>#{}, query_string=><<>>, remote_ip=>{192,168,144,1}, req_cookies=>#{}, req_headers=>[{<<"accept">>,<<"*/*">>},
 {<<"accept-encoding">>,<<"gzip">>},
 {<<"accept-language">>,<<"es-ES,es;q=0.9">>},
 {<<"cdn-loop">>,<<"cloudflare; subreqs=1">>},
 {<<"cf-ew-via">>,<<"15">>},
 {<<"cf-ipcity">>,<<"El Astillero">>},
 {<<"cf-ipcontinent">>,<<"EU">>},
 {<<"cf-ipcountry">>,<<"ES">>},
 {<<"cf-iplatitude">>,<<"43.40160">>},
 {<<"cf-iplongitude">>,<<"-3.81530">>},
 {<<"cf-postal-code">>,<<"39610">>},
 {<<"cf-ray">>,<<"86f8f97ad3bb69eb-MAD">>},
 {<<"cf-region">>,<<"Cantabria">>},
 {<<"cf-region-code">>,<<"CB">>},
 {<<"cf-timezone">>,<<"Europe/Madrid">>},
 {<<"cf-visitor">>,<<"{\"scheme\":\"https\"}">>},
 {<<"cf-worker">>,<<"hdsplus.workers.dev">>},
 {<<"content-length">>,<<"125">>},
 {<<"content-type">>,<<"text/plain">>},
 {<<"host">>,<<"stats.hdsplus.co">>},
 {<<"origin">>,<<"https://hdsplus.co">>},
 {<<"priority">>,<<"u=3, i">>},
 {<<"referer">>,<<"https://hdsplus.co/">>},
 {<<"sec-fetch-dest">>,<<"empty">>},
 {<<"sec-fetch-mode">>,<<"cors">>},
 {<<"sec-fetch-site">>,<<"cross-site">>},
 {<<"user-agent">>,
  <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15">>},
 {<<"x-forwarded-for">>,<<"2a06:98c0:3600::103, 172.70.57.158">>},
 {<<"x-forwarded-proto">>,<<"https">>},
 {<<"x-forwarded-scheme">>,<<"https">>},
 {<<"x-real-ip">>,<<"172.70.57.158">>}], request_path=><<"/api/event">>, resp_body=>nil, resp_cookies=>#{}, resp_headers=>[{<<"cache-control">>,<<"max-age=0, private, must-revalidate">>},
 {<<"x-request-id">>,<<"F8NcsOwkU1YbXDIAAbSB">>},
 {<<"access-control-allow-credentials">>,<<"true">>},
 {<<"access-control-allow-origin">>,<<"*">>},
 {<<"access-control-expose-headers">>,<<>>}]})

from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

x-forwarded-for are completely different. Are both of these your own requests or real users? Either way, Plausible is picking the first IP address in the x-forwarded-for list, which is different from x-real-ip (whatever it is) which is the last element in the x-forwarded-for list. According to https://en.wikipedia.org/wiki/X-Forwarded-For, the client IP address is the first element in the list, so Plausible is correct, at least according to Wikipedia.

from analytics.

viriatusX avatar viriatusX commented on June 21, 2024

Yes.
I tried again:

WORKER OFF

11:4:44.229315 <0.10633.0> 'Elixir.PlausibleWeb.RemoteIP':get(#{owner=><0.10633.0>, port=>80, private=>#{'Elixir.PlausibleWeb.Router'=>[], phoenix_view=>#{'_'=>'Elixir.PlausibleWeb.Api.ExternalView'}, plug_session_fetch=>done, plug_session=>#{}, before_send=>[#Fun<Elixir.Plug.Session.0.76384852>,#Fun<Elixir.Plug.Telemetry.0.54455629>], phoenix_endpoint=>'Elixir.PlausibleWeb.Endpoint', phoenix_action=>event, phoenix_layout=>#{'_'=>{'Elixir.PlausibleWeb.LayoutView',app}}, phoenix_controller=>'Elixir.PlausibleWeb.Api.ExternalController', phoenix_format=><<"json">>, phoenix_router=>'Elixir.PlausibleWeb.Router'}, scheme=>http, status=>nil, script_name=>[], state=>unset, host=><<"stats.hdsplus.co">>, cookies=>#{}, params=>#{}, '__struct__'=>'Elixir.Plug.Conn', halted=>false, assigns=>#{}, method=><<"POST">>, adapter=>{'Elixir.Plug.Cowboy.Conn',#{pid => <0.10632.0>,port => 80,
                             scheme => <<"http">>,version => 'HTTP/1.1',
                             path => <<"/api/event">>,
                             host => <<"stats.hdsplus.co">>,
                             peer => {{192,168,144,1},60416},
                             sock => {{192,168,144,2},8000},
                             bindings => #{},
                             ref => 'Elixir.PlausibleWeb.Endpoint.HTTP',
                             cert => undefined,
                             headers =>
                                 #{<<"accept">> => <<"*/*">>,
                                   <<"accept-encoding">> => <<"gzip, br">>,
                                   <<"accept-language">> =>
                                       <<"es-ES,es;q=0.9">>,
                                   <<"cdn-loop">> => <<"cloudflare">>,
                                   <<"cf-ipcontinent">> => <<"EU">>,
                                   <<"cf-ipcountry">> => <<"ES">>,
                                   <<"cf-iplatitude">> => <<"41.39490">>,
                                   <<"cf-iplongitude">> => <<"2.17560">>,
                                   <<"cf-ray">> => <<"86f90f1c0af68686-MAD">>,
                                   <<"cf-region">> => <<"Catalonia">>,
                                   <<"cf-region-code">> => <<"CT">>,
                                   <<"cf-timezone">> => <<"Europe/Madrid">>,
                                   <<"cf-visitor">> =>
                                       <<"{\"scheme\":\"https\"}">>,
                                   <<"content-length">> => <<"74">>,
                                   <<"content-type">> => <<"text/plain">>,
                                   <<"host">> => <<"stats.hdsplus.co">>,
                                   <<"origin">> => <<"https://hdsplus.co">>,
                                   <<"priority">> => <<"u=3, i">>,
                                   <<"referer">> => <<"https://hdsplus.co/">>,
                                   <<"sec-fetch-dest">> => <<"empty">>,
                                   <<"sec-fetch-mode">> => <<"cors">>,
                                   <<"sec-fetch-site">> => <<"same-site">>,
                                   <<"user-agent">> =>
                                       <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15">>,
                                   <<"x-forwarded-for">> =>
                                       <<"83.44.134.248, 172.64.236.58">>,
                                   <<"x-forwarded-proto">> => <<"https">>,
                                   <<"x-forwarded-scheme">> => <<"https">>,
                                   <<"x-real-ip">> => <<"172.64.236.58">>},
                             method => <<"POST">>,qs => <<>>,
                             path_info => undefined,streamid => 1,
                             body_length => 74,has_body => true,
                             host_info => undefined}}, secret_key_base=><<"jMI5V6xYzyfwHSHhYnluvqHKa69CdX7XOyKeh925wAOrpaq7yaZLQEovqh2mJJrbnuXSGZ0k0rHY0VxaQ4Q//w==">>, body_params=>#{'__struct__'=>'Elixir.Plug.Conn.Unfetched', aspect=>body_params}, path_info=>[<<"api">>,<<"event">>], path_params=>#{}, query_params=>#{}, query_string=><<>>, remote_ip=>{192,168,144,1}, req_cookies=>#{}, req_headers=>[{<<"accept">>,<<"*/*">>},
 {<<"accept-encoding">>,<<"gzip, br">>},
 {<<"accept-language">>,<<"es-ES,es;q=0.9">>},
 {<<"cdn-loop">>,<<"cloudflare">>},
 {<<"cf-ipcontinent">>,<<"EU">>},
 {<<"cf-ipcountry">>,<<"ES">>},
 {<<"cf-iplatitude">>,<<"41.39490">>},
 {<<"cf-iplongitude">>,<<"2.17560">>},
 {<<"cf-ray">>,<<"86f90f1c0af68686-MAD">>},
 {<<"cf-region">>,<<"Catalonia">>},
 {<<"cf-region-code">>,<<"CT">>},
 {<<"cf-timezone">>,<<"Europe/Madrid">>},
 {<<"cf-visitor">>,<<"{\"scheme\":\"https\"}">>},
 {<<"content-length">>,<<"74">>},
 {<<"content-type">>,<<"text/plain">>},
 {<<"host">>,<<"stats.hdsplus.co">>},
 {<<"origin">>,<<"https://hdsplus.co">>},
 {<<"priority">>,<<"u=3, i">>},
 {<<"referer">>,<<"https://hdsplus.co/">>},
 {<<"sec-fetch-dest">>,<<"empty">>},
 {<<"sec-fetch-mode">>,<<"cors">>},
 {<<"sec-fetch-site">>,<<"same-site">>},
 {<<"user-agent">>,
  <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15">>},
 {<<"x-forwarded-for">>,<<"83.44.134.248, 172.64.236.58">>},
 {<<"x-forwarded-proto">>,<<"https">>},
 {<<"x-forwarded-scheme">>,<<"https">>},
 {<<"x-real-ip">>,<<"172.64.236.58">>}], request_path=><<"/api/event">>, resp_body=>nil, resp_cookies=>#{}, resp_headers=>[{<<"cache-control">>,<<"max-age=0, private, must-revalidate">>},
 {<<"x-request-id">>,<<"F8NdfzMB-RhBddoAAPeC">>},
 {<<"access-control-allow-credentials">>,<<"true">>},
 {<<"access-control-allow-origin">>,<<"*">>},
 {<<"access-control-expose-headers">>,<<>>}]})

WORKER ON

11:5:07.657798 <0.10637.0> 'Elixir.PlausibleWeb.RemoteIP':get(#{owner=><0.10637.0>, port=>80, private=>#{'Elixir.PlausibleWeb.Router'=>[], phoenix_view=>#{'_'=>'Elixir.PlausibleWeb.Api.ExternalView'}, plug_session_fetch=>done, plug_session=>#{}, before_send=>[#Fun<Elixir.Plug.Session.0.76384852>,#Fun<Elixir.Plug.Telemetry.0.54455629>], phoenix_endpoint=>'Elixir.PlausibleWeb.Endpoint', phoenix_action=>event, phoenix_layout=>#{'_'=>{'Elixir.PlausibleWeb.LayoutView',app}}, phoenix_controller=>'Elixir.PlausibleWeb.Api.ExternalController', phoenix_format=><<"json">>, phoenix_router=>'Elixir.PlausibleWeb.Router'}, scheme=>http, status=>nil, script_name=>[], state=>unset, host=><<"stats.hdsplus.co">>, cookies=>#{}, params=>#{}, '__struct__'=>'Elixir.Plug.Conn', halted=>false, assigns=>#{}, method=><<"POST">>, adapter=>{'Elixir.Plug.Cowboy.Conn',#{pid => <0.10636.0>,port => 80,
                             scheme => <<"http">>,version => 'HTTP/1.1',
                             path => <<"/api/event">>,
                             host => <<"stats.hdsplus.co">>,
                             peer => {{192,168,144,1},38690},
                             sock => {{192,168,144,2},8000},
                             bindings => #{},
                             ref => 'Elixir.PlausibleWeb.Endpoint.HTTP',
                             cert => undefined,
                             headers =>
                                 #{<<"accept">> => <<"*/*">>,
                                   <<"accept-encoding">> => <<"gzip">>,
                                   <<"accept-language">> =>
                                       <<"es-ES,es;q=0.9">>,
                                   <<"cdn-loop">> =>
                                       <<"cloudflare; subreqs=1">>,
                                   <<"cf-ew-via">> => <<"15">>,
                                   <<"cf-ipcontinent">> => <<"EU">>,
                                   <<"cf-ipcountry">> => <<"ES">>,
                                   <<"cf-iplatitude">> => <<"41.39490">>,
                                   <<"cf-iplongitude">> => <<"2.17560">>,
                                   <<"cf-ray">> => <<"86f90fae53e85e5c-MAD">>,
                                   <<"cf-region">> => <<"Catalonia">>,
                                   <<"cf-region-code">> => <<"CT">>,
                                   <<"cf-timezone">> => <<"Europe/Madrid">>,
                                   <<"cf-visitor">> =>
                                       <<"{\"scheme\":\"https\"}">>,
                                   <<"cf-worker">> =>
                                       <<"hdsplus.workers.dev">>,
                                   <<"content-length">> => <<"74">>,
                                   <<"content-type">> => <<"text/plain">>,
                                   <<"host">> => <<"stats.hdsplus.co">>,
                                   <<"origin">> => <<"https://hdsplus.co">>,
                                   <<"priority">> => <<"u=3, i">>,
                                   <<"referer">> => <<"https://hdsplus.co/">>,
                                   <<"sec-fetch-dest">> => <<"empty">>,
                                   <<"sec-fetch-mode">> => <<"cors">>,
                                   <<"sec-fetch-site">> => <<"cross-site">>,
                                   <<"user-agent">> =>
                                       <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15">>,
                                   <<"x-forwarded-for">> =>
                                       <<"2a06:98c0:3600::103, 188.114.111.178">>,
                                   <<"x-forwarded-proto">> => <<"https">>,
                                   <<"x-forwarded-scheme">> => <<"https">>,
                                   <<"x-real-ip">> => <<"188.114.111.178">>},
                             method => <<"POST">>,qs => <<>>,
                             path_info => undefined,streamid => 1,
                             body_length => 74,has_body => true,
                             host_info => undefined}}, secret_key_base=><<"jMI5V6xYzyfwHSHhYnluvqHKa69CdX7XOyKeh925wAOrpaq7yaZLQEovqh2mJJrbnuXSGZ0k0rHY0VxaQ4Q//w==">>, body_params=>#{'__struct__'=>'Elixir.Plug.Conn.Unfetched', aspect=>body_params}, path_info=>[<<"api">>,<<"event">>], path_params=>#{}, query_params=>#{}, query_string=><<>>, remote_ip=>{192,168,144,1}, req_cookies=>#{}, req_headers=>[{<<"accept">>,<<"*/*">>},
 {<<"accept-encoding">>,<<"gzip">>},
 {<<"accept-language">>,<<"es-ES,es;q=0.9">>},
 {<<"cdn-loop">>,<<"cloudflare; subreqs=1">>},
 {<<"cf-ew-via">>,<<"15">>},
 {<<"cf-ipcontinent">>,<<"EU">>},
 {<<"cf-ipcountry">>,<<"ES">>},
 {<<"cf-iplatitude">>,<<"41.39490">>},
 {<<"cf-iplongitude">>,<<"2.17560">>},
 {<<"cf-ray">>,<<"86f90fae53e85e5c-MAD">>},
 {<<"cf-region">>,<<"Catalonia">>},
 {<<"cf-region-code">>,<<"CT">>},
 {<<"cf-timezone">>,<<"Europe/Madrid">>},
 {<<"cf-visitor">>,<<"{\"scheme\":\"https\"}">>},
 {<<"cf-worker">>,<<"hdsplus.workers.dev">>},
 {<<"content-length">>,<<"74">>},
 {<<"content-type">>,<<"text/plain">>},
 {<<"host">>,<<"stats.hdsplus.co">>},
 {<<"origin">>,<<"https://hdsplus.co">>},
 {<<"priority">>,<<"u=3, i">>},
 {<<"referer">>,<<"https://hdsplus.co/">>},
 {<<"sec-fetch-dest">>,<<"empty">>},
 {<<"sec-fetch-mode">>,<<"cors">>},
 {<<"sec-fetch-site">>,<<"cross-site">>},
 {<<"user-agent">>,
  <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15">>},
 {<<"x-forwarded-for">>,<<"2a06:98c0:3600::103, 188.114.111.178">>},
 {<<"x-forwarded-proto">>,<<"https">>},
 {<<"x-forwarded-scheme">>,<<"https">>},
 {<<"x-real-ip">>,<<"188.114.111.178">>}], request_path=><<"/api/event">>, resp_body=>nil, resp_cookies=>#{}, resp_headers=>[{<<"cache-control">>,<<"max-age=0, private, must-revalidate">>},
 {<<"x-request-id">>,<<"F8NdhKd16y-Y36EAAPiC">>},
 {<<"access-control-allow-credentials">>,<<"true">>},
 {<<"access-control-allow-origin">>,<<"*">>},
 {<<"access-control-expose-headers">>,<<>>}]})


from analytics.

ruslandoga avatar ruslandoga commented on June 21, 2024

Do you know where x-forwarded-for and x-real-ip come from? One of them seems to be wrong. According to https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#x-forwarded-for CloudFlare adds the client IP address (the real IP address) to the beginning of the list. And since Plausible is reading it from the beginning of the list, it's not a bug in Plausible.

from analytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.