Proxy ServersProxy Tools
Troubleshooting7 min read

Catching Proxy Leaks: DNS, Headers, and Routing Checks

A proxy can be configured, authenticated, and still not carry all of your traffic. A bypass list, a redirect, a DNS lookup performed locally, or a subresource loaded outside the proxy can send part of a request over the direct connection without raising an error.

Magnifying glass inspecting a proxy route for DNS and header leaks

Leak checks are about correctness: confirming that the exit IP, the name resolution, and the headers match what the job assumes. They belong in the pre-flight step of every pipeline, not in a one-off investigation after a result looks wrong.

Three kinds of leak worth checking

A routing leak happens when a request skips the proxy entirely, for example because an environment variable excludes a host, a client library ignores the proxy setting, or a redirect opens a new connection without the configuration. The visible symptom is usually an unexpected exit IP, not an error.

A DNS leak happens when the client resolves a hostname locally instead of letting the proxy network resolve it. The request still goes through the proxy, but name resolution happened somewhere else, which can reveal the resolver network and can break location targeting on sites that care about it.

A header leak happens when a proxy or an intermediary adds a forwarding header such as Via or X-Forwarded-For, or when the destination can otherwise identify the path the request took. Which headers appear depends on the proxy implementation, so check rather than assume.

Verify routing hop by hop

Start with a request to an IP echo endpoint through the proxy and compare the reported address with the one you expect. Then repeat the check after a redirect, because the redirected request may not inherit the proxy configuration in every client.

Look at exclusion settings before blaming the proxy. Many HTTP libraries honour NO_PROXY or a per-host bypass list, and a single entry for a domain or an internal suffix can remove it from the proxy path. Print the effective client configuration with credentials redacted, then test the host that fails.

For browser automation, remember that the proxy applies to the whole context or browser, but extensions, service workers, and some embedded frames can behave differently. The Playwright and Puppeteer setup guide covers where the setting has to be applied.

  • Check the exit IP before the job and again after any redirect chain.
  • Search the configuration for bypass lists and excluded hosts.
  • Test a second destination, not only the one that works.
  • Store the exit IP with the result so later anomalies can be traced.

Understand DNS per protocol

With an HTTP proxy and an HTTPS destination, the client opens a CONNECT tunnel and sends the hostname to the proxy, which resolves it. With a plain HTTP destination, the request line normally carries the full URL and the proxy resolves the host. In both cases name resolution happens on the proxy side.

SOCKS5 is where the difference matters. Unless the client uses the variant that asks the proxy to resolve names, it may look up the hostname locally and connect to the resulting address through the proxy. The traffic still exits through the proxy, but the lookup did not, which is the behaviour to verify if location accuracy depends on resolution.

Test with a destination you control or an echo service that reports the resolved address, and use the client option that delegates resolution for the protocol you chose. Writing the choice into the job configuration makes it reviewable instead of tribal knowledge.

Inspect the headers the target receives

Use a header echo endpoint through the proxy and read the full request as the destination sees it. Check for forwarding headers, unexpected client addresses, and a Host value that does not match the target. Then compare the same request sent directly to see what the proxy added.

Headers also carry routing instructions you set deliberately, such as country or session identifiers. Confirm that they arrive only where intended and that they are not cached and reused across unrelated tasks. The header inspector is a quick way to view what a server receives during a manual check.

Browser-specific checks

In a desktop browser, WebRTC can discover local and public network addresses through ICE candidates, independently of the HTTP proxy. That matters for manual quality-assurance sessions where a real browser profile is used. Headless automation contexts normally do not generate ICE traffic, but verify rather than assume if the policy for the run requires it.

Extensions and background services are the other browser-specific source of direct connections. A clean automation profile with no extensions is easier to reason about, and it removes a class of traffic that never appears in the page network log.

Capture the evidence for each check: the exit IP, the reported resolution path where available, the headers, and the browser profile used. A leak check that produces only a pass or fail cannot be audited later.

Make the check part of the pipeline

Run the same three checks at the start of every job and after any change to the client, the endpoint, or the target. Treat a mismatch as a failure that stops the job rather than a warning, because a dataset collected through the wrong route is expensive to identify after the fact.

Keep the check small. One request to an echo endpoint, one redirect test, and one header inspection cost almost nothing and catch the most common configuration mistakes before they reach production.

Redirects, CDNs, and subrequests

The first request is the easiest to verify and the least likely to hide a problem. Pages pull scripts, styles, images, and API calls from several hosts, and any of those can take a different path if the client applies proxy rules per host. A browser context normally proxies all of its traffic, but an HTTP client with a bypass list or a custom transport may not.

Record the hosts contacted by a representative page and test a few of them directly through the proxy. If a CDN host resolves and connects without the proxy, the page may still render, which is exactly why the problem survives casual testing. The result looks correct while part of the traffic never used the route you paid for.

Redirects deserve the same attention. Follow the entire chain and confirm the exit IP after the final hop. A client that recreates the connection for the redirect without the proxy configuration can silently switch routes at that point, and the destination server will see a different network than the first request.

When a workflow uses several clients, keep the checks with each client. A request library, a headless browser, and a command-line tool can all have different defaults, and a check that passes in one says nothing about the others. The proxy list checker is useful for a quick manual probe; the pipeline still needs its own assertions.

  • List the hosts a representative page contacts and test more than the main document.
  • Assert the exit IP after the final redirect, not only at the start of the chain.
  • Repeat the check for every client type used by the job.
  • Fail the job on a mismatch instead of logging a warning and continuing.

Separating a leak from target behaviour

Not every unexpected result is a leak. A target may show a different country because its own geolocation database disagrees, because a cookie carries a previous location, or because a CDN serves a regional variant from the nearest edge. The IP echo endpoint and the target can both be right about different questions.

Change one variable at a time. First confirm the exit IP and ASN through an independent echo service. Then request the target with a fresh context and no cookies. If the exit IP is correct and the target still shows the wrong region, the problem is likely the target or the request headers rather than the route.

Headers that imply a location are easy to overlook: language, currency, and time zone settings can override what the IP suggests. Inspect what the client sends and remove values that contradict the intended market. This is also why a pre-flight assertion should cover the page element the job depends on, not only the network address.

Keep the two results side by side in the run record. When someone later questions a location, the pair shows whether the route was correct and the target disagreed, or whether the route itself was wrong. That distinction changes the fix.

A repeatable check for CI

A leak check is most valuable when it runs automatically before the expensive part of a job. Write it as a small script with four assertions: the echo endpoint responded, the exit IP belongs to the expected country or ASN, a redirect chain kept the same route, and the destination received no unexpected forwarding header.

Use the same client and configuration as the real job. A check written with curl will not catch a misconfigured request library, and a check written without the session header will not catch a targeting mistake. Import the client configuration from the job code so the two cannot drift apart.

Print the evidence with credentials redacted: exit IP, reported country, ASN, session identifier, and the redirect chain. Store the record with the job. When an assertion fails, the record usually explains why without a second run.

Keep the runtime small. A handful of requests against neutral endpoints is enough; the check should not become a miniature workload that consumes the bandwidth budget from the bandwidth guide.

Key takeaways

  • Routing, DNS, and headers leak in different ways and need separate checks.
  • Redirects and bypass lists are the usual reasons a request skips the proxy.
  • DNS behaviour depends on the protocol; verify it instead of assuming.

Frequently asked questions

Does an HTTP proxy always handle DNS for me?

For HTTP and HTTPS destinations through an HTTP proxy, name resolution normally happens at the proxy. With SOCKS5, the client may resolve locally unless it is configured to delegate resolution, so test the exact client and URL scheme you use.

Why does an IP checker show the proxy location but the target shows another country?

The target may use its own geolocation database, a CDN edge, or account and cookie settings. Check the elements you actually depend on, and treat the IP echo result as one input rather than the final answer.

Can WebRTC leak an address in headless automation?

Automation contexts generally do not generate ICE traffic, but the safe approach is to verify in the environment you deploy. For manual browser sessions, inspect the browser internals and disable or restrict non-proxied traffic if the run requires it.

Need proxies for this workflow?

Graviix provides residential, mobile, datacenter, and static ISP proxies with country and city targeting, rotating or sticky sessions, and a documented HTTP API.

Talk to the team

Continue reading