Proxies That Work logo

DNS Resolution with Proxies: Local DNS, Remote DNS, and Leak Prevention

By Jesse Lewis•11/23/2026•5 min read
DNS Resolution with Proxies: Local DNS, Remote DNS, and Leak Prevention

When a web crawler uses a proxy, its HTTP requests may travel through the proxy while some DNS queries still leave through the developer's local network. That mismatch can expose destination hostnames to an unintended resolver, produce inconsistent regional results, or make an automated job fail only after deployment.

DNS resolution with proxies determines whether the client or proxy-side infrastructure translates a destination hostname into an IP address. Local DNS means the client performs that lookup; remote DNS means the client passes the hostname to the proxy for resolution. The correct behavior depends on the proxy protocol and the application, not simply on whether a proxy is enabled.

For bulk crawling and testing, verify this behavior across every worker.

Quick Answer: Local DNS vs Remote DNS

Question Local DNS Remote DNS
Who resolves the destination hostname? The client or its configured resolver The proxy or proxy-side network
What does the proxy receive? Usually a destination IP address A destination hostname
Which resolver may see the lookup? Client-side resolver Proxy-side resolver
Common example SOCKS5 using socks5:// in cURL HTTP CONNECT or SOCKS5 using socks5h://
Key consideration Local exposure and region mismatch Proxy-side resolver behavior and trust

Neither method automatically guarantees privacy. Remote DNS only changes the resolution path. It does not mean the proxy uses encrypted DNS or that its resolver is geographically colocated with the exit IP.

Two Different Hostnames May Need DNS Resolution

It helps to separate the proxy endpoint from the destination website.

Consider a crawler configured to connect through proxy.example.test:8080 before fetching https://example.com/.

  1. The client may first resolve proxy.example.test to reach the proxy server.
  2. The destination name, example.com, may then be resolved locally or by the proxy, depending on the protocol.

Resolving the proxy endpoint is normal and is not, by itself, a destination DNS leak.

How DNS Resolution Works with HTTP and HTTPS Proxies

A conventional HTTP forward proxy receives the destination hostname as part of the client's proxy request. For an HTTPS website, the client commonly uses the HTTP CONNECT method:

CONNECT example.com:443 HTTP/1.1
Host: example.com:443

Once the proxy accepts the tunnel, it connects upstream and forwards traffic between the client and destination. The client establishes TLS to the destination through that tunnel. The HTTP protocol defines CONNECT in RFC 9110.

For this normal CONNECT flow, the client does not need to resolve the destination hostname locally before asking the proxy to connect. However, a browser extension, prefetcher, separate library, or direct-connection fallback may still perform local lookups outside that request.

An HTTPS destination differs from an HTTPS proxy endpoint. TLS does not itself determine who resolves the destination.

SOCKS5: Why socks5:// and socks5h:// Behave Differently

SOCKS5 is another proxy protocol, supported by many tools but not interchangeable with HTTP proxies. Its destination-address handling allows clients to use an IP address or send a hostname.

In cURL and Python Requests, the proxy URL scheme selects the DNS behavior:

  • socks5:// resolves the destination on the client and passes the resulting IP address to the SOCKS server.
  • socks5h:// sends the destination hostname to the SOCKS server, so resolution happens remotely.

The distinction is documented in cURL's SOCKS proxy guide. Adding the h changes where destination lookups occur.

ProxiesThatWork provides HTTP/HTTPS datacenter proxy services, with IP-based authentication listed in its current plans. Its standard HTTP proxy setup should not be configured as a SOCKS5 endpoint. The SOCKS5 examples here explain the broader networking concept for developers working across multiple proxy protocols.

What Is a DNS Leak When Using a Proxy?

A DNS leak occurs when a destination lookup follows an unintended DNS path rather than the path required by the application's network or privacy policy.

For example, a testing environment may require destination lookups to occur through a remote SOCKS5 service. If the application uses socks5://, the local resolver can still receive those queries. The website request might successfully traverse the proxy, making the problem easy to miss.

Common causes include client-side hostname resolution, browser DNS prefetching, unproxied background requests, NO_PROXY exceptions, incorrect environment variables, and retry logic that falls back to a direct connection.

A DNS leak is not necessarily an IP leak. DNS queries and application connections can take different paths. Both need independent verification.

Why DNS Behavior Matters for Bulk Crawling and Testing

Regional Data Consistency

DNS-based traffic steering and content delivery networks may return different IP addresses based on resolver location, caching, or other routing information. A crawler targeting one region but resolving elsewhere can encounter different backend routes or inconsistent latency.

Remote DNS can reduce certain mismatches, but cannot guarantee a specific country or city. Validate the actual egress region and collected page content. For common production workloads, see the supported proxy use cases.

Reliable Distributed Workers

A hundred container workers do not necessarily share the same DNS configuration. They may inherit host, cluster, or application-specific DNS settings.

Better Failure Diagnosis

If a job records every failure as a "proxy error," engineers cannot distinguish a failed lookup of the proxy hostname from a proxy-side destination failure or an HTTP response from the website. Separate metrics reduce unnecessary retries and make pool-level troubleshooting more useful.

Test HTTP Proxy DNS Behavior with cURL

Run these commands against permitted test destinations. Replace the illustrative .test endpoint with a real proxy address.

curl --verbose \
  --proxy http://proxy.example.test:8080 \
  --connect-timeout 5 --max-time 20 \
  https://example.com/ -o /dev/null

For a conventional HTTP proxy, look for a connection to the proxy followed by CONNECT example.com:443. This shows the hostname was sent for tunnel establishment, but it does not prove that no other application or operating-system component queried DNS locally.

For a separate, genuinely SOCKS5-compatible service, compare:

# Destination hostname resolved by the client
curl --proxy socks5://socks.example.test:1080 \
  https://example.com/ -o /dev/null

# Destination hostname resolved through the SOCKS proxy
curl --proxy socks5h://socks.example.test:1080 \
  https://example.com/ -o /dev/null

Both commands may still resolve socks.example.test locally to establish the initial proxy connection. Do not use these SOCKS URL schemes for an HTTP-only proxy endpoint.

Configure Proxy Requests in Python

For an HTTP proxy, Python Requests can use the same proxy endpoint for HTTP and HTTPS destinations:

import requests

proxy = "http://proxy.example.test:8080"

with requests.Session() as session:
    session.trust_env = False  # Avoid inherited proxy settings
    session.proxies = {
        "http": proxy,
        "https": proxy,
    }
    response = session.get(
        "https://example.com/",
        timeout=(5, 20),
    )
    response.raise_for_status()
    print(response.status_code)

The https key identifies the destination scheme; it does not mean the proxy endpoint uses TLS. For a SOCKS-enabled client, Requests supports socks5h:// after installing its optional SOCKS dependencies, as explained in the Requests advanced documentation.

Disabling inherited environment settings is appropriate for this controlled demonstration. In production, explicitly configure any required trust bundles, credentials, or allowed bypass rules rather than relying on ambiguous defaults.

How to Detect DNS Leaks

A dependable DNS leak test requires more than visiting an IP-check website.

  1. Use an authorized test domain. Ideally, control the hostname and its authoritative DNS logs, so the experiment is repeatable.
  2. Record intended paths. Document the proxy protocol, client version, resolver configuration, egress network, and whether destination DNS should be local or remote.
  3. Capture client-side DNS activity. On a Linux test host, inspect conventional DNS packets while issuing a known request:
sudo tcpdump -ni any 'udp port 53 or tcp port 53'
  1. Correlate the request. Distinguish a lookup for the proxy hostname from a lookup for the destination and compare timestamps with application logs.
  2. Repeat across worker environments. Test containers, CI runners, browser automation, and scheduled servers independently.

Port-53 capture is only one signal. Cached answers, DNS-over-HTTPS, and DNS-over-TLS may not appear there. A convincing assessment combines client observation, controlled DNS logs where available, and connection-path testing.

Prevent DNS Leaks in Production Proxy Fleets

The strongest controls are configuration consistency and fail-closed network behavior.

  • Centralize proxy settings. Use one managed configuration for schemes, endpoints, exceptions, and assigned workers.
  • Disable unintended direct fallback. If a job requires a proxy, a failed proxy connection should not automatically cause a direct destination request.
  • Audit bypass rules. Review NO_PROXY, application proxy exclusions, DNS prefetch, browser settings, and background processes.
  • Test IPv4 and IPv6. Verify that both families follow the intended routing policy where enabled.
  • Separate failure metrics. Track proxy-host resolution, proxy connectivity, tunnel errors, destination errors, and extraction failures.
  • Retest after updates. Changes to browser engines, containers, HTTP libraries, or network gateways can alter routing behavior.

For bulk workflows, the compatible websites directory helps identify targets to test, but does not certify your DNS configuration.

DNS and Proxy Troubleshooting Table

Symptom Likely explanation What to check
Cannot resolve proxy hostname Client-side resolver or endpoint error Proxy hostname, local DNS, network policy
Proxy connects but destination fails Proxy-side lookup, upstream route, or destination issue CONNECT response, upstream logs, target availability
Results vary across regions CDN steering, resolver placement, caching, or content variation Resolver and egress locations, response content
Destination lookup appears locally Client-side resolution, bypass, or background process SOCKS scheme, environment, process attribution
Works on a laptop, fails in CI Different proxy or DNS settings Container and runner configuration

Frequently Asked Questions

Does an HTTP proxy use local or remote DNS?

For standard HTTP forward-proxy requests, the client sends the destination hostname to the proxy. In an HTTPS CONNECT request, the proxy handles the upstream connection. The client may still resolve the proxy hostname locally, and unrelated processes may make separate DNS requests.

What is the difference between socks5 and socks5h?

In cURL and Python Requests, socks5 resolves destination hostnames on the client, while socks5h delegates destination resolution to the SOCKS5 proxy. The service must support SOCKS5 for either configuration to work.

Does ProxiesThatWork support SOCKS5 remote DNS?

ProxiesThatWork's current plans provide HTTP/HTTPS datacenter proxies with IP-based authentication, not an advertised SOCKS5 endpoint. For normal HTTPS requests through our HTTP proxies, the destination hostname is sent in the CONNECT request, allowing proxy-side infrastructure to establish the upstream connection. SOCKS5-specific socks5h:// configuration is therefore not required for our standard setup.

Can HTTPS prevent DNS leaks?

No. HTTPS protects application traffic between TLS endpoints, but it does not automatically decide which resolver receives DNS queries. Proxy configuration, DNS settings, and bypass behavior still matter.

Do rotating proxies automatically prevent DNS leaks?

No. Rotation changes the selected proxy or exit address, not necessarily the DNS lookup path. A rotating pool still requires consistent client configuration and testing.

How can developers verify DNS behavior before scaling?

Test a controlled hostname, observe DNS and network activity, confirm the expected proxy path, and run the same checks from each deployment environment. A successful HTTP response alone is not sufficient proof.

Conclusion

DNS resolution is part of proxy infrastructure, not a detail to ignore after a connection succeeds. Distinguish the proxy hostname from the destination, understand HTTP CONNECT and SOCKS5 resolution differences, and check for browser, application, or network-level bypasses.

For teams running large-scale crawlers and automated tests, consistent configuration, accurate logging, and repeatable DNS-path tests matter more than broad claims of anonymity. ProxiesThatWork offers bulk HTTP/HTTPS datacenter proxy plans for teams that need dependable proxy access while retaining control over their own collection and testing environments.

About the Author

J

Jesse Lewis

Jesse Lewis is a researcher and content contributor for ProxiesThatWork, covering compliance trends, data governance, and the evolving relationship between AI and proxy technologies. He focuses on helping businesses stay compliant while deploying efficient, scalable data-collection pipelines.

Proxies That Work logo
© 2026 ProxiesThatWork LLC. All Rights Reserved.
DNS Resolution with Proxies: Local vs Remote DNS - ProxiesThatWork