How to Fix WebRTC Leaks on Browsers and Proxy Clients
Leak Fix Last updated:
Summary
WebRTC leaks occur when browsers send UDP STUN packets outside your proxy. Fix them either by disabling non-proxied UDP in the browser or by enabling TUN mode with UDP relay in your proxy client.
How WebRTC Leaks and Reverse Split-Tunneling Happen
Before setting up peer-to-peer audio or video, WebRTC probes a STUN server over UDP to gather reachable IP candidates (ICE). DetectRadar runs a same-domain UDP STUN server (stun:detectradar.com:3478) and compares gathered public candidates against your current HTTP exit IP:
- Standard leak: Your web page exits via a proxy, while WebRTC UDP packets escape over your local ISP and expose your true public IP.
- Reverse split-tunnel: Your web page connects directly via your local ISP, while WebRTC UDP packets route through a proxy or datacenter exit.
- No leak: Matching public IP, mDNS-masked hostnames (
*.local), or disabled WebRTC. On the dedicated WebRTC Leak Test page, LAN-only private candidates also pass as No leak (the home overview marks them for review).
Browser-Level Fixes
1. Firefox
- Open
about:configand accept the prompt. - If you do not need browser voice or video calls, set
media.peerconnection.enabledtofalseto turn off WebRTC completely. - To keep video calls working, leave it enabled and set
media.peerconnection.ice.proxy_only_if_behind_proxytotrue. Note that this option applies only when Firefox itself is configured with a browser proxy — if you rely solely on system-wide TUN, apply the client settings below as well.
2. Brave, Chrome, and Edge
- Brave: Open Settings → Privacy and security → WebRTC IP handling policy and pick Disable non-proxied UDP.
- Chrome / Edge: Install Google’s official WebRTC Network Limiter extension and choose Disable non-proxied UDP (or configure enterprise policy
WebRtcIPHandlingtodisable_non_proxied_udp). Note that over HTTP-only proxies without UDP relay, disabling non-proxied UDP may break browser calls. - Modern Chrome and Edge already mask local LAN IPs via mDNS (
*.local), but public candidates can still leak if UDP bypasses your proxy.
3. Safari (macOS / iOS)
Safari heavily restricts ICE candidates until camera or microphone permissions are granted. When an iOS device still reports a WebRTC leak, the cause is usually UDP routing or rule alignment inside the proxy client.
Proxy Client Fixes (Keep Calls Working)
Routing UDP through the same tunnel fixes leaks without disabling browser media:
| Client | What to Check | Recommended Change |
|---|---|---|
| Clash Verge / Mihomo | TUN & udp: true | HTTP system proxy does not capture UDP; enable TUN mode and confirm the node has udp: true (nodes missing it can still leak or drop UDP) |
| Surge / Stash | Enhanced Mode & udp-relay | Enable Enhanced Mode (VIF/TUN), set udp-relay=true on the node, and keep STUN and HTTPS on the same exit |
| Shadowrocket | Global & node UDP | Enable Settings → UDP plus UDP Forwarding on the active node, and keep UDP 3478 aligned with web rules |
| v2rayN (Windows) | System proxy vs. TUN | Enable TUN mode and verify the outbound supports UDP relay |
Verify
Re-run the WebRTC Leak Test to compare before and after in the same browser. If an extra IPv6 address appears among your public candidates, double-check dual-stack routing on the IPv6 Leak Test.