- A web server cannot see a VPN; it can look up who operates the visitor's IP address
- An address owned by a hosting provider, a known VPN service or the Tor network is almost never a home connection
- The lookup is one HTTP request and catches the commercial VPNs most people use
- Residential VPNs and proxies are the hard case for an IP lookup, and a VPN alone says nothing about intent
How can you tell if someone is using a VPN?
You cannot observe a VPN from a web server. What you can do is look up the visitor's IP address and ask who operates it. An address that belongs to a hosting provider, to a known VPN service or to the Tor network is almost certainly not somebody's home or mobile connection, and that is how every VPN detection product works. The lookup takes one HTTP request and catches the commercial VPNs most people use. It does not catch everything, and a VPN on its own is not evidence of bad intent.
The signals, and what each one misses
| Signal | What it catches | What it misses or gets wrong |
|---|---|---|
| Datacenter address the IP belongs to a hosting or cloud provider |
Most commercial VPN servers, cloud-hosted proxies, scrapers and bots. | Company gateways and cloud security services are datacenter addresses too, with ordinary employees behind them. |
| Known VPN server the IP is on a list of VPN exit servers |
Named VPN providers, including those that rent addresses outside the big clouds. | New servers until the lists catch up; self-hosted VPNs. |
| Tor exit relay the IP is on Tor's public exit list |
Practically all Tor traffic: the project publishes its exits. | Very little. It is the most reliable signal of the five. |
| Open or public proxy the IP is on a proxy list |
HTTP and SOCKS proxies that anyone can use. | Lists age quickly; a home address stays listed after the proxy is gone. |
| Mismatch with the browser time zone or language does not fit the IP's country |
Residential proxies and VPNs that the address lists have not seen yet. | Travellers, expatriates and misconfigured devices. A hint, never a verdict. |
The first four are facts about the address and can be checked on the server. The fifth needs data from the browser and is only worth collecting where fraud is expensive. Client-side tricks such as WebRTC address leaks or latency measurements are unreliable in current browsers and intrusive for the visitor; they are not worth building on.
Check a visitor's IP in one request
Take the address from your own server's connection data (behind a load balancer: from the
X-Forwarded-For value your own proxy sets, never from a header the client controls)
and look it up:
curl "https://ip-api.io/api/v1/ip/78.55.53.58?api_key=YOUR_API_KEY"
The answer carries the location and, in suspicious_factors, one flag per signal (the location block is shortened here):
{
"ip": "78.55.53.58",
"isp": "Telefonica Germany",
"asn": "AS6805",
"location": { "country": "Germany", "city": "Berlin", "timezone": "Europe/Berlin" },
"suspicious_factors": {
"is_vpn": false,
"is_proxy": false,
"is_tor_node": false,
"is_datacenter": false,
"is_spam": false,
"is_crawler": false,
"is_threat": false
}
}
This address is a home connection in Berlin, so every flag is false. For a VPN server
is_vpn or is_datacenter is true. In application code the
whole check is four lines:
const res = await fetch(
`https://ip-api.io/api/v1/ip/${visitorIp}?api_key=${process.env.IP_API_IO_KEY}`
);
const { suspicious_factors: f } = await res.json();
const anonymised = f.is_vpn || f.is_proxy || f.is_tor_node || f.is_datacenter;
The same flags are available in the SDKs for nine languages, and you can try any address without a key on the VPN detection page.
What to do with the answer
| Where | Reasonable reaction to a VPN, proxy or datacenter flag |
|---|---|
| Reading content, browsing a shop | None. Privacy tools are normal here. |
| Sign-up, free trial, promotion | Add a step: e-mail confirmation, captcha, or one trial per verified address. |
| Login | Ask for the second factor when the flag is new for this account. |
| Payment, payout | Review together with other signals; a combined risk score is built for this. |
| Licensed or region-locked content | Block if the contract requires it, and say why, so that real customers know to switch the VPN off. |
Blocking every flagged visitor is the expensive mistake. People on iCloud Private Relay, on a company network or behind a mobile carrier's shared address are flagged for reasons that have nothing to do with them; Why is my IP detected as a VPN or proxy? lists those cases from the visitor's side.
What an IP lookup cannot tell you
- Residential VPNs and proxies that are not on a list yet. Traffic that leaves through somebody's home connection has a home address. Until the address has been seen and reported, only its behaviour or a mismatch with the browser gives it away.
- A VPN server at home. Someone connecting through their own router abroad looks like a resident of that country, because the address is one.
- The person. A flag tells you about the route, not about who is using it or why.
For most sites that is enough: the visitors worth a second look are the ones who combine an anonymising route with something else that is unusual, and the route is the part you can check in one request.