Client-side VPN detection signals (and their limits)
A browser gives away a few clues when its user is on a VPN, though fewer than you might hope, and fewer each year. This page covers WebRTC ICE candidates, TLS JA3/JA4 fingerprints and the timezone-versus-IP check, along with what breaks them: mDNS obfuscation, anti-fingerprinting features in browsers, and user-agents that lie. These signals make good inputs to a graded verdict, but they can't stand in for server-side multi-source detection.
By Mehmood Ali ·
Can browser signals detect VPN use?
Partly, but only as advisory inputs to a server-side verdict. A page can collect four kinds of client-side signal. WebRTC ICE candidates can expose a server-reflexive public IP that differs from the HTTP source IP, though mDNS hostnames and strict privacy modes often leave the result empty. The TLS JA3 or JA4 fingerprint is computed on the server from the ClientHello, and a mismatch with the claimed user-agent points to spoofing, a VPN client or automation. The browser timezone compared with the IP's country is a weak prior. Handshake round-trip timing is better measured by the server than by the browser. Each signal can be missing, randomized or defeated, and browsers keep limiting what pages can read. Record an empty WebRTC result as unknown, not clean. Treat the server-side /v1/check verdict as the floor, and let client data raise or lower confidence, for example when separating iCloud Private Relay from a commercial VPN.
What a page can collect from the browser
There are four kinds of client-side signal worth collecting:
- WebRTC ICE candidates. The browser's peer-connection APIs gather candidate addresses via STUN. A server-reflexive candidate can reveal a public IP that differs from the HTTP source IP, which strongly suggests one of the two paths is being relayed.
- TLS fingerprint (JA3/JA4). Computed on the server from the ClientHello. When the fingerprint doesn't fit the claimed user-agent, you are usually looking at spoofing, a VPN client or headless automation. The JA3/JA4 glossary entry has more background.
- Timezone and language.
Intl.DateTimeFormat().resolvedOptions().timeZone andnavigator.languagecome from the OS rather than the network. A US-East timezone on a Frankfurt IP is a weak prior, but it costs nothing to collect. - RTT and timing.
PerformanceResourceTimingexposes TCP and TLS handshake durations for fresh connections. A gap between transport RTT and TLS RTT is part of the detection approach in the SNITCH paper (NDSS 2025; check the published paper), though the server is in a better position to measure it than the browser.
WebRTC ICE candidate gathering
This is the well-known “WebRTC leak”. Open an RTCPeerConnection, add a data channel that does nothing, and read the candidates the browser gathers. The ones you care about are server-reflexive (typ srflx): the public IP as a STUN server saw it. If that differs from the IP your HTTP server saw, something in between is relaying the traffic.
// Best-effort STUN-based public-IP discovery, ~1.5s bounded.
function getWebRtcPublicIp(): Promise<string | undefined> {
return new Promise((resolve) => {
if (!("RTCPeerConnection" in window)) return resolve(undefined);
const pc = new RTCPeerConnection({
iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
});
pc.createDataChannel("probe");
const timer = setTimeout(() => { pc.close(); resolve(undefined); }, 1500);
pc.onicecandidate = (e) => {
if (!e.candidate) return;
const parts = e.candidate.candidate.split(" ");
const type = parts[parts.indexOf("typ") + 1];
const ip = parts[4];
if (type === "srflx" && /^[0-9.]+$/.test(ip)) {
clearTimeout(timer);
pc.close();
resolve(ip);
}
};
pc.createOffer().then((o) => pc.setLocalDescription(o)).catch(() => {
clearTimeout(timer); resolve(undefined);
});
});
}The snippet comes back empty on browsers that use mDNS hostnames for local candidates, in strict privacy modes that never emit srflx, and whenever the STUN server doesn't answer. Record an empty result as “unknown” rather than “clean”.
TLS JA3/JA4 fingerprinting
JA3 and JA4 both fingerprint the TLS ClientHello. Two clients that honestly report the same browser version should share a fingerprint, so a mismatch points to spoofing or a VPN/proxy client sitting in the path. JA4, the newer of the two, hashes more fields and is harder to collide.
The fingerprint has to be captured on the server from the TLS handshake, because browsers have no JavaScript API for it. If you run Caddy, the practical options are a TLS terminator in front of the application that extracts the ClientHello, or a reverse-proxy module that computes JA3. When the browser calls /v1/check directly, we capture the handshake at our edge and return the result as a signal.
Timezone, language, and screen geometry
Any page can collect these at almost no cost. Treat them as a prior and nothing more:
function collectClientSignals() {
return {
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, // e.g. "Europe/Berlin"
language: navigator.language, // e.g. "en-US"
screen: `${screen.width}x${screen.height}`, // e.g. "1920x1080"
platform: navigator.platform, // e.g. "MacIntel"
};
}Compare the OS timezone with the country the IP geolocates to. For the vast majority of real users they agree. When they don't, it is usually a traveller (allow them), someone on a VPN that exits in another country (the case you are trying to detect), or, rarely, a person who set their OS timezone by hand. A strong mismatch on a datacenter ASN deserves a real bump in the risk score.
Send client signals alongside the IPLogs check
The API accepts optional client-side fields and merges them with the server-side result, so you only ever handle one verdict:
const body = {
user_agent: navigator.userAgent,
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
language: navigator.language,
webrtc_ip: await getWebRtcPublicIp(), // may be undefined
};
const r = await fetch("https://iplogs.com/v1/check", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(body),
});
const verdict = await r.json();The server takes the source IP from the request itself and runs the seven-layer pipeline, folding in whichever client signals apply. If the WebRTC IP differs from the HTTP source IP, that appears as its own signal in the response.
Why client-side alone isn't enough
- User-agents lie. A custom client or a VPN browser extension can send whatever user-agent it likes. JA3/JA4 catches this only because the TLS layer gives it away.
- Browsers actively limit fingerprinting. Firefox has a privacy.resistFingerprinting mode, Safari ships its own fingerprinting protections, and Chrome has been narrowing what WebRTC reveals about IPs. Any one client signal may be missing or randomised.
- JavaScript can be off. Crawlers, some accessibility tools and a fair number of security-conscious users run without it. A layer that depends on JS never sees that traffic, whether it comes from attackers or from legitimate visitors.
Combining client signals with the server verdict
Treat the server-side verdict (/v1/check on the visitor IP) as your floor. Client-side data adds confidence and helps with edge cases, such as telling Apple Private Relay apart from a commercial VPN or spotting a browser that disagrees with its OS. The longer argument against single-signal blocking is in why complete VPN blocking can't be a compliance solution.
FAQ
Can JavaScript see the user's real IP behind a VPN?
Sometimes, through WebRTC ICE candidate gathering. A server-reflexive candidate discovered via STUN can reveal a public IP that differs from the HTTP source IP. Modern browsers hide local IPs behind mDNS hostnames, and several also limit public-IP exposure, so the signal is partial and getting weaker over time. Use it as a hint, never as ground truth.
What is a JA3 or JA4 fingerprint, and where does it come from?
Both are hashes of the TLS ClientHello a client sends when it opens an HTTPS connection. The server computes the hash from the connection; nothing runs in the browser. If the user-agent says Chrome but the TLS fingerprint doesn't match Chrome, there is very likely a VPN client, an automation framework or a proxy in the path.
Why is timezone vs IP geolocation a useful signal?
The browser exposes the OS timezone through Intl.DateTimeFormat. A timezone of America/Los_Angeles on an IP that geolocates to Frankfurt means the user is either travelling or being routed somewhere else. That proves little by itself, but it raises the prior, particularly alongside a datacenter ASN or a known VPN exit.
Are client-side signals enough on their own?
No. Each one can be defeated in isolation, and browsers keep cutting back what a page can collect. Use the server-side verdict from /v1/check as the primary signal and let client-side data move the score up or down. The server-side multi-source verdict is the one to act on.
Won't users see the WebRTC permission prompt?
No. STUN-based IP discovery through RTCPeerConnection needs no permission; only camera or microphone access does. Browser privacy patches have been narrowing candidate gathering instead, for years now, which is why this signal keeps getting weaker.
The server-side half is covered in the implementation walkthrough. See also the WebRTC-leak glossary entry and the accuracy benchmark, or run the live IP checker on your own connection.