Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

Google Search shows my real location based on my IP while using Xray

Open Evv1L opened this issue 3 years ago • 2 comments

TL;DR

Google Search shows my real location while using Xray + Vless + XTLS + Nginx server on Android and Linux, but other websites and IP tests shows my VPS IP where Xray server is located. Is this hardcoded behavior?

Expected Behavior

I expect Google Search (and other Google product pages) to say that I'm (for example) in Netherlands while using Xray.

Current Behavior

Google Search shows the city and country I am in "From your IP address" at the bottom of search results page while using Xray. Sometimes Google says correct city, but completely wrong city district.

All other websites (and search engines) says that I'm in Netherlands. DNS Leak tests shows DNS servers only from Netherlands and IP Leak tests shows only Netherlands IP where my VPS is located.

Steps to Reproduce

I'm using VPS with Debain 11:

  1. Enable BBR
  2. Install and configure Nginx:
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	root /var/www/html;
	index index.html index.htm index.nginx-debian.html;

	server_name DOMAIN;

	location / {
		try_files $uri $uri/ =404;
	}
}
  1. Get only SSL certificate using Certbot
certbot certonly --nginx
  1. Install Xray 1.6.0 server:
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install -u root
  • Xray server config:
{
    "log": {
        "loglevel": "warning"
    },
    "inbounds": [
        {
            "port": 443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "##################################",
                        "flow": "xtls-rprx-direct",
                        "level": 0,
                        "email": "[email protected]"
                    }
                ],
                "decryption": "none",
                "fallbacks": [
                    {
                        "dest": 80
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "xtls",
                "xtlsSettings": {
                    "alpn": [
                        "http/1.1"
                    ],
                    "certificates": [
                        {
                            "certificateFile": "/etc/letsencrypt/live/DOMAIN/fullchain.pem",
                            "keyFile": "/etc/letsencrypt/live/DOMAIN/privkey.pem"
                        }
                    ]
                }
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}

  1. Configure Xray Linux client
  • Create Xray config
{
    "log": {
        "loglevel": "warning"
    },
    "inbounds": [
        {
            "port": 10800,
            "listen": "127.0.0.1",
            "protocol": "socks",
            "settings": {
                "udp": true
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "vless",
            "settings": {
                "vnext": [
                    {
                        "address": "VPS_IP_ADDRESS",
                        "port": 443,
                        "users": [
                            {
                                "id": "###########################################",
                                "flow": "xtls-rprx-direct",
                                "encryption": "none",
                                "level": 0
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "xtls",
                "xtlsSettings": {
                    "serverName": "DOMAIN_NAME"
                }
            }
        }
    ]
}

  • Run Xray from config:
./xray -config=config.json
  • Configure Firefox to use Xray: Enable SOCKS5 proxy with address 127.0.0.1:10800 and Enable DNS through SOCKS5 proxy.
  1. Configure Android client:
  • Install v2rayNG
  • Create VLESS config with following parameters:
Remarks: Any name
Address: VPS IP address
Port: 443
ID: Your UUID
Flow: xtls-rprx-direct
Encryption: none

Network: tcp
Head type: none
Request host И Path - empty
TLS: xtls
SNI: DOMAIN.NAME
allowInsecure: false
  • (OR import custom config from Linux client)
  • Run v2rayNG in VPN mode
  1. Visit Google Search and IP/DNS leak test sites like Whoer or IPLeak. Google should say your location "From your IP address", but all other sites should show you your Xray server address.

Other notes

  • I don't live in China.
  • I expect to route ALL (except localhost) my traffic to my Xray server
  • Linux client uses Cloudflare DNS in /etc/resolv.conf
  • I tried to use Shadowsocks + Cloak on the same VPS and everything worked fine - all sites shows the same VPS IP as expected.
  • I'm using Firefox with uBlock Origin on both Linux and Android clients.
  • I'm visiting Google Search in Incognito mode and I don't have any Google accounts on Android device.
  • Device location and location permissions in Firefox are also disabled.

Evv1L avatar Oct 25 '22 23:10 Evv1L

It has nothing to do with xray or any proxy affairs. Google has it own way to update GeoIP database by tracking user's location based on phone's location permission, and it can be affected by neighboring IP address

https://vps.dance/google-ip-location.html try to read by google translate

SakuraSakuraSakuraChan avatar Oct 26 '22 09:10 SakuraSakuraSakuraChan

It has nothing to do with xray or any proxy affairs. Google has it own way to update GeoIP database by tracking user's location based on phone's location permission, and it can be affected by neighboring IP address

https://vps.dance/google-ip-location.html try to read by google translate

Yea, I configured OpenVPN on the same VPS and issue is still here. It's not Xray issue. Thank you for response!

Evv1L avatar Oct 30 '22 22:10 Evv1L