Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It takes a while for umami to correctly identify a visitor's geolocation #2754

Closed
aaro-n opened this issue May 23, 2024 · 3 comments
Closed
Labels
bug Something isn't working fixed in dev Fixed in the dev branch

Comments

@aaro-n
Copy link

aaro-n commented May 23, 2024

Describe the Bug

Note: This problem occurs occasionally, not every time
When a new visitor visits the website, umami displays the visitor's IP address as Unkonwn, and after a while, correctly displays the visitor's IP address.

Database

PostgreSQL

Relevant log output

NO

Which Umami version are you using? (if relevant)

2.3.11

Which browser are you using? (if relevant)

Chrome,Firefox,Windows and Android

How are you deploying your application? (if relevant)

Docker,fly.io
捕获

@franciscao633
Copy link
Collaborator

odd. I wonder if this is a UI display only, but the geolocation is being correctly recorded in the session table. I know we do not update sessions, so I'm thinking the data itself should be correct.

@aaro-n
Copy link
Author

aaro-n commented May 25, 2024

  1. In umami real-time mode, when a visitor visits the website, umami will display the URL visited by the visitor and have a color icon. At this time, the visited geographical IP will not be displayed or not.

  2. After a few seconds, the visitor's geographical location will be displayed or "Unkonwn" will be displayed directly. At this time, in real-time mode, the color icon before the blocking URL will be changed to other colors, and both the geographical location and "Unkonwn" will be displayed. Change the color in front of the URL.

  3. When the displayed geographical location is "Unkonwn", it may take a few seconds to correctly identify the visitor's geographical location, and at this time the color in front of the URL will be changed.

    Summarize

    Visitors start visiting the website (red) --> Correctly identify the visitor's geographical location (blue)

    Visitors start visiting the website (red) --> Display the visitor's geographical location as "Unkonwn" (purple) --> Correctly identify the visitor's geographical location (orange)

    status quo

    This problem will cause the number of visitors counted by umami to be falsely high, and a large number of visitors' geographical locations will display "Unkonwn"

    Schedule

fly.toml

# fly.toml app configuration file generated for umami-nrt on 2023-07-13T10:04:47+08:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "zzxccv"
primary_region = "nrt"

[env]
  APP_SECRET = "3fv9CxVcXN5tfs"
  CLIENT_IP_HEADER = "X-Forwarded-For"
  COLLECT_API_ENDPOINT = "/api/5xwnN593BdYTW5"
  DATABASE_URL = "postgres://postgres.xxxxx:zzzz@aws-0-ap-northeast-1.pooler.supabase.com:6543/postgres?pgbouncer=true"
  DISABLE_UPDATES = "1"
  FORCE_SSL = "1"
  PORT = "8080"
  TRACKER_SCRIPT_NAME = "cambCec4PHZQoh"
#  HOSTNAME = "0.0.0.0"


  # 设置默认语言
  DEFAULT_LOCALE = "zh-CN"

[build]
  image = "ghcr.io/umami-software/umami:postgresql-latest"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1
  processes = ["app"]

Nginx

server {
     listen 80;
     listen [::]:80;
     server_name um.123.xyz;
     return 301 https://$host$request_uri;
 }

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

     server_name um.123.xyz;

     ssl_protocols      TLSv1.2 TLSv1.3;

     ssl_certificate /home/www/nginx/ssl/etc/live/letsencrypt/fullchain.pem;
     ssl_certificate_key /home/www/nginx/ssl/etc/live/letsencrypt/privkey.pem;

     ssl_prefer_server_ciphers on;
     ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

     ssl_buffer_size 4k;

     ssl_session_cache   shared:SSL:50m;
     ssl_session_timeout 4h;

     ssl_stapling on;
     ssl_stapling_verify on;
     ssl_trusted_certificate /home/www/nginx/ssl/etc/live/letsencrypt/fullchain.pem;
     resolver 8.8.8.8 8.8.4.4 223.5.5.5 valid=60s;
     resolver_timeout 2s;

    # cloudflare-ip
    # IP-V4
    set_real_ip_from 173.245.48.0/20;
    set_real_ip_from 103.21.244.0/22;
    set_real_ip_from 103.22.200.0/22;
    set_real_ip_from 103.31.4.0/22;
    set_real_ip_from 141.101.64.0/18;
    set_real_ip_from 108.162.192.0/18;
    set_real_ip_from 190.93.240.0/20;
    set_real_ip_from 188.114.96.0/20;
    set_real_ip_from 197.234.240.0/22;
    set_real_ip_from 198.41.128.0/17;
    set_real_ip_from 162.158.0.0/15;
    set_real_ip_from 104.16.0.0/13;
    set_real_ip_from 104.24.0.0/14;
    set_real_ip_from 172.64.0.0/13;
    set_real_ip_from 131.0.72.0/22;
    # IP-V6
   set_real_ip_from 2400:cb00::/32;
   set_real_ip_from 2606:4700::/32;
   set_real_ip_from 2803:f800::/32;
   set_real_ip_from 2405:b500::/32;
   set_real_ip_from 2405:8100::/32;
   set_real_ip_from 2a06:98c0::/29;
   set_real_ip_from 2c0f:f248::/32;
   
   # cloudfront-ip
   set_real_ip_from 120.52.22.96/27;
set_real_ip_from 205.251.249.0/24;
set_real_ip_from 180.163.57.128/26;   
set_real_ip_from 204.246.168.0/22;   
set_real_ip_from 18.160.0.0/15;   
set_real_ip_from 205.251.252.0/23;  
set_real_ip_from 54.192.0.0/16;   
set_real_ip_from 204.246.173.0/24;   
set_real_ip_from 54.230.200.0/21;   
set_real_ip_from 120.253.240.192/26;   
set_real_ip_from 116.129.226.128/26;   
set_real_ip_from 130.176.0.0/17;   
set_real_ip_from 108.156.0.0/14;   
set_real_ip_from 99.86.0.0/16;   
set_real_ip_from 205.251.200.0/21;   
set_real_ip_from 223.71.71.128/25;   
set_real_ip_from 13.32.0.0/15;   
set_real_ip_from 120.253.245.128/26;   
set_real_ip_from 13.224.0.0/14;   
set_real_ip_from 70.132.0.0/18;   
set_real_ip_from 15.158.0.0/16;   
set_real_ip_from 13.249.0.0/16;   
set_real_ip_from 18.238.0.0/15;   
set_real_ip_from 18.244.0.0/15;   
set_real_ip_from 205.251.208.0/20;   
set_real_ip_from 65.9.128.0/18;   
set_real_ip_from 130.176.128.0/18;   
set_real_ip_from 58.254.138.0/25;   
set_real_ip_from 54.230.208.0/20;   
set_real_ip_from 116.129.226.0/25;   
set_real_ip_from 52.222.128.0/17;   
set_real_ip_from 18.164.0.0/15;   
set_real_ip_from 64.252.128.0/18;   
set_real_ip_from 205.251.254.0/24;   
set_real_ip_from 54.230.224.0/19;   
set_real_ip_from 71.152.0.0/17;   
set_real_ip_from 216.137.32.0/19;   
set_real_ip_from 204.246.172.0/24;   
set_real_ip_from 18.172.0.0/15;  
set_real_ip_from 120.52.39.128/27;   
set_real_ip_from 118.193.97.64/26;   
set_real_ip_from 223.71.71.96/27;   
set_real_ip_from 18.154.0.0/15;   
set_real_ip_from 54.240.128.0/18;   
set_real_ip_from 205.251.250.0/23;   
set_real_ip_from 180.163.57.0/25;   
set_real_ip_from 52.46.0.0/18;   
set_real_ip_from 223.71.11.0/27;   
set_real_ip_from 52.82.128.0/19;   
set_real_ip_from 54.230.0.0/17;   
set_real_ip_from 54.230.128.0/18;   
set_real_ip_from 54.239.128.0/18;   
set_real_ip_from 130.176.224.0/20;   
set_real_ip_from 36.103.232.128/26;   
set_real_ip_from 52.84.0.0/15;   
set_real_ip_from 143.204.0.0/16;   
set_real_ip_from 144.220.0.0/16;   
set_real_ip_from 120.52.153.192/26;   
set_real_ip_from 119.147.182.0/25;   
set_real_ip_from 120.232.236.0/25;  
set_real_ip_from 54.182.0.0/16;   
set_real_ip_from 58.254.138.128/26;   
set_real_ip_from 120.253.245.192/27;   
set_real_ip_from 54.239.192.0/19;   
set_real_ip_from 18.64.0.0/14;   
set_real_ip_from 120.52.12.64/26;   
set_real_ip_from 99.84.0.0/16;   
set_real_ip_from 130.176.192.0/19;  
set_real_ip_from 52.124.128.0/17;   
set_real_ip_from 204.246.164.0/22;   
set_real_ip_from 13.35.0.0/16;   
set_real_ip_from 204.246.174.0/23;   
set_real_ip_from 36.103.232.0/25;  
set_real_ip_from 119.147.182.128/26;   
set_real_ip_from 118.193.97.128/25;   
set_real_ip_from 120.232.236.128/26;   
set_real_ip_from 204.246.176.0/20;   
set_real_ip_from 65.8.0.0/16;   
set_real_ip_from 65.9.0.0/17;   
set_real_ip_from 108.138.0.0/15;   
set_real_ip_from 120.253.241.160/27;   
set_real_ip_from 64.252.64.0/18;
set_real_ip_from 3.113.196.64/26;   
set_real_ip_from 13.113.203.0/24;   
set_real_ip_from 52.199.127.192/26;
set_real_ip_from 13.124.199.0/24;   
set_real_ip_from 3.35.130.128/25;   
set_real_ip_from 52.78.247.128/26;   
set_real_ip_from 13.233.177.192/26;   
set_real_ip_from 15.207.13.128/25;   
set_real_ip_from 15.207.213.128/25;   
set_real_ip_from 52.66.194.128/26;   
set_real_ip_from 13.228.69.0/24;   
set_real_ip_from 52.220.191.0/26;   
set_real_ip_from 13.210.67.128/26;   
set_real_ip_from 13.54.63.128/26;   
set_real_ip_from 99.79.169.0/24;   
set_real_ip_from 18.192.142.0/23;   
set_real_ip_from 35.158.136.0/24;   
set_real_ip_from 52.57.254.0/24;   
set_real_ip_from 13.48.32.0/24;   
set_real_ip_from 18.200.212.0/23;   
set_real_ip_from 52.212.248.0/26;   
set_real_ip_from 3.10.17.128/25;   
set_real_ip_from 3.11.53.0/24;   
set_real_ip_from 52.56.127.0/25;   
set_real_ip_from 15.188.184.0/24;  
set_real_ip_from 52.47.139.0/24;   
set_real_ip_from 18.229.220.192/26;   
set_real_ip_from 54.233.255.128/26;   
set_real_ip_from 3.231.2.0/25;   
set_real_ip_from 3.234.232.224/27;   
set_real_ip_from 3.236.169.192/26;   
set_real_ip_from 3.236.48.0/23;   
set_real_ip_from 34.195.252.0/24;   
set_real_ip_from 34.226.14.0/24;   
set_real_ip_from 13.59.250.0/26;   
set_real_ip_from 18.216.170.128/25;   
set_real_ip_from 3.128.93.0/24;   
set_real_ip_from 3.134.215.0/24;   
set_real_ip_from 52.15.127.128/26;   
set_real_ip_from 3.101.158.0/23;   
set_real_ip_from 52.52.191.128/26;   
set_real_ip_from 34.216.51.0/25;   
set_real_ip_from 34.223.12.224/27;   
set_real_ip_from 34.223.80.192/26;   
set_real_ip_from 35.162.63.192/26;   
set_real_ip_from 35.167.191.128/26;   
set_real_ip_from 44.227.178.0/24;   
set_real_ip_from 44.234.108.128/25;   
set_real_ip_from 44.234.90.252/30;

     real_ip_header X-Forwarded-For;
     real_ip_recursive on;

     client_max_body_size 5m;
     client_body_timeout 60;

     access_log  /tmp/logs/umami.log;

     gzip on;
     gzip_types application/xml application/json text/css text/javascript application/javascript;
     gzip_vary on;
     gzip_comp_level 6;
     gzip_min_length 500;

     location / {
         proxy_pass https://zzxccv.fly.dev;
         proxy_redirect off;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;

         proxy_ssl_name $host;
         proxy_ssl_server_name on;
         
         proxy_hide_header fly-request-id;
         proxy_hide_header via;
         proxy_hide_header x-powered-by;
     }

     location =/api/5xwnN593BdYTW5 {
         proxy_pass https://zzxccv.fly.dev;

         proxy_hide_header fly-request-id;
         proxy_hide_header via;
         proxy_hide_header x-powered-by;

         proxy_buffering on;
         proxy_http_version 1.1;
         proxy_ssl_session_reuse off;
         proxy_ssl_server_name on;
         proxy_set_header X-Forwarded-Proto https;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Host  $host;

         proxy_ssl_name $host;
     }

    location ~ .*\.(gif|jpg|woff2|png|ico|ico|svg|css|js)(.*) {
         proxy_pass https://zzxccv.fly.dev;
         proxy_redirect off;
         proxy_set_header Host $host;
         proxy_cache cache_one;
         proxy_cache_valid 200 302 24h;
         proxy_cache_valid 301 30d;
         proxy_cache_valid any 5m;
         proxy_cache_key "$host$request_uri$args";

         proxy_buffer_size 16k;
         proxy_buffers 4 32k;
         proxy_busy_buffers_size 96k;
         proxy_temp_file_write_size 96k;

         expires 90d;
         add_header Cache-Control "public";

         proxy_ssl_name $host;
         proxy_ssl_server_name on;
         
         proxy_hide_header fly-request-id;
         proxy_hide_header via;
         proxy_hide_header x-powered-by;
    }

}

@mikecao mikecao added bug Something isn't working fixed in dev Fixed in the dev branch labels Jun 21, 2024
@mikecao
Copy link
Collaborator

mikecao commented Jun 21, 2024

Fixed in v2.12.0.

@mikecao mikecao closed this as completed Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in dev Fixed in the dev branch
Projects
None yet
Development

No branches or pull requests

3 participants