DEV Community

Oleg Vasilov
Oleg Vasilov

Posted on

Converting Proxy Formats and Checking Exit IP Leaks in cURL, Python, and Playwright

Proxy exports rarely match the exact format your HTTP client or headless browser expects. Most dashboards export colon-delimited strings like host:port:user:pass, while curl, httpx, and Playwright each require different syntax—and a single unescaped special character in a password or a local DNS lookup can silently leak your real IP.

Here is a practical checklist for converting proxy strings cleanly and verifying your exit IP before running jobs.

1. Why Proxy Strings Break Across Tools

Three common failure points when wiring proxies into scripts:

  1. Format mismatch: host:port:user:pass works in many GUI tools, but CLI clients and libraries expect RFC 3986 URLs (http://user:pass@host:port) or structured objects ({ server, username, password }).
  2. Unescaped password characters: Symbols like @, :, /, or # inside a password break URL parsing unless percent-encoded (encodeURIComponent).
  3. Local DNS leaks over SOCKS5: Using --socks5 instead of --socks5-hostname resolves domain names on your local machine before the request enters the tunnel.

If you need to reformat large batches of proxies quickly without pasting credentials into a server-side tool, the free Proxy Format Converter runs 100% client-side in your browser and outputs user:pass@host:port, http://, socks5://, cURL, Python, Playwright, and JSON snippets.

2. Testing Exit IP & DNS Behavior in cURL

Always verify the exit IP directly through the tunnel using a lightweight JSON endpoint such as https://proxyverge.com/api/ip:

# HTTP / HTTPS proxy
curl -s -x "http://USER:PASS@HOST:PORT" https://proxyverge.com/api/ip

# SOCKS5 proxy with remote DNS resolution (prevents local DNS leaks)
curl -s --socks5-hostname "USER:PASS@HOST:PORT" https://proxyverge.com/api/ip
Enter fullscreen mode Exit fullscreen mode

Check that the returned ip, country, and asn match the target proxy pool rather than your host machine.

3. Verifying Proxies in Python (httpx)

In Python, pass the formatted proxy URL to httpx.Client and inspect the returned JSON before starting a scraping worker:

import httpx

proxy_url = "http://USER:PASS@HOST:PORT"

with httpx.Client(proxy=proxy_url, timeout=15.0) as client:
    resp = client.get("https://proxyverge.com/api/ip")
    resp.raise_for_status()
    print(resp.json())
Enter fullscreen mode Exit fullscreen mode

If your password contains special characters, encode username and password with urllib.parse.quote(val, safe="") before building proxy_url.

4. Parsing host:port:user:pass for Playwright (Node.js)

Playwright does not accept credentials inside proxy.server; it requires separate username and password fields:

import { chromium } from 'playwright';

function parseProxy(line) {
  const [host, port, username, password] = line.trim().split(':');
  return {
    server: `http://${host}:${port}`,
    username,
    password,
  };
}

const browser = await chromium.launch({
  proxy: parseProxy('HOST:PORT:USER:PASS'),
});

const page = await browser.newPage();
await page.goto('https://proxyverge.com/tools/my-ip', { waitUntil: 'networkidle' });
await browser.close();
Enter fullscreen mode Exit fullscreen mode

Opening the IP & Leak Checker in your Playwright context lets you inspect not only the exit IP and ASN, but also WebRTC and DNS leak signals in a real browser environment.

Quick Pre-Flight Checklist

  • Convert host:port:user:pass to the exact target format (and URL-encode credentials for URLs).
  • Use remote DNS (--socks5-hostname or socks5h://) for SOCKS5 tunnels.
  • Verify exit IP, ASN, and WebRTC/DNS before launching concurrent workers.

Top comments (0)