How DNS Resolution Affects Proxy Location: CDN and GeoDNS

Published:

12 minute read

Acar Diveroli
Written by: Acar Diveroli
Lines run from a GeoDNS server to edge servers in two regions; the rack in the exit region is blue, the other line is dashed

GeoDNS is a DNS method that returns a different IP address for the same domain depending on where the query comes from. The name server does not estimate that location from your IP. It uses the resolver that forwards the query, or the EDNS Client Subnet data. When you use a proxy and the name is resolved on your own device, the answer is picked for your region. The connection, however, opens from an exit in another country, and the two locations do not match. This article covers how GeoDNS estimates location, where the name is resolved in each setup and how to check which server answers.

GeoDNS and location estimates

In GeoDNS, the answer is chosen by the domain's authoritative name server. That server does not see you. The query reaches it from a recursive resolver, not from your device. The resolver can be your ISP's DNS server, a server on a company network or a public DNS service.

The authoritative server estimates location in two ways. The first is the resolver's IP address: if the resolver is close to you, so is the estimate. The second is the EDNS Client Subnet (ECS) option. Defined in RFC 7871, it lets the resolver add a truncated part of the client address to the query.

For privacy, RFC 7871 recommends the first 24 bits of an IPv4 address and the first 56 bits of an IPv6 address. The authoritative server picks the answer for that subnet and uses ECS again to state which network the answer is valid for. Not every resolver sends ECS, and not every name server uses it. Without ECS, the estimate rests on the resolver's address alone.

The result is simple. A DNS answer carries the location of the network the query came from. If the query left from Türkiye, the answer is picked for Türkiye.

How the CDN edge is chosen

A CDN (content delivery network) serves the same content from edge servers in different regions. There are two common ways to send a visitor to a suitable edge: DNS-based routing and anycast. We explained how a CDN works in general in What Is a CDN.

With DNS-based routing, each region gets a different IP address. The edge is fixed the moment the DNS answer arrives, and the connection goes to that IP no matter who opens it. With anycast, the same IP address is announced from many regions. The connection reaches the edge closest to its exit point, based on network routing.

RoutingWhat picks the edgeIf the name resolves on your device
DNS-based (GeoDNS)IP in the DNS answerYou get the edge for your region
AnycastNetwork the connection leaves fromLittle effect, edge follows the exit
Both combinedDNS first, then the networkRegion comes from DNS

You cannot tell from outside which method a site uses. So decide yourself where the name is resolved.

Effects of local resolution

If the name is resolved on your device and the connection opens from a remote exit, DNS and the exit point to two different countries. Your device in Türkiye resolves the name and gets the address of an edge near Türkiye. The exit in Germany connects to that address. Traffic goes from Germany to the edge near Türkiye, and the response returns the same way.

This has three effects:

  • Extra latency. Every request goes to a distant edge instead of one near the exit. Round-trip time grows.
  • Mixed content. Most edge servers set the country from the IP the connection comes from, so the page often shows the right country. But with a regional cache, a region-specific subdomain or a redirect rule, content from another country can appear.
  • Mismatch. The site sees a connection from one region at an edge reserved for another. A normal visit rarely produces this pattern.

There is one more side effect: your local DNS server sees the domains you visit. We covered this side of the schemes in SOCKS5 vs SOCKS5H. If the prices, stock or search results you collect do not match the expected country, first check where DNS is resolved.

Who resolves the name

The proxy type and the client's URL scheme decide who resolves the target name. With an HTTP proxy, the client always sends the name to the proxy. In a plain HTTP request, the name sits inside the full URL: GET http://example.com/. For HTTPS, the client asks for CONNECT example.com:443, and that request carries the target as host and port.

SetupWho resolves the nameWhat the proxy sees
HTTP proxy (http://)ProxyDomain name
socks5h://ProxyDomain name
socks5://Your deviceIP address
Chrome + SOCKS5ProxyDomain name
Firefox + SOCKS5Depends on a settingThe "Proxy DNS when using SOCKS v5" option

According to the Chromium documentation, SOCKS4 always resolves the name on the client. Do not use SOCKS4 for country-targeted work.

The "proxy side" may not be a single point. On some networks the entry gateway resolves the name, on others the exit. If the gateway and the exit are in different countries, the DNS answer can follow the gateway's region. You see this through the check below, not in documentation.

Checking the edge server

The idea is to query the same domain first locally, then through the proxy, and compare the two answers. If they differ, the site answers by location. If the answer through the proxy belongs to the exit region, the setup is correct. Run the check with a few requests on your own site or on targets you are allowed to test.

The first step is the DNS answers. Resolve the name locally with nslookup. Then query the same name through the proxy with DNS-over-HTTPS (DoH). In this query, the DNS service sees the proxy exit's IP, not yours.

bash
# 1. Local resolution: the answer your network gets
nslookup www.example.com

# 2. DoH through the proxy: the answer the exit gets
curl -s -x "http://user:pass@pr.proxynet.io:8000" \
  "https://dns.google/resolve?name=www.example.com&type=A"

The Google Public DNS JSON API also accepts an edns_client_subnet parameter. You can pass a subnet by hand and see whether the answer changes by region. The value 0.0.0.0/0 asks that no subnet data be sent to the name server at all.

The second step is the response headers. In a request through a proxy, the client does not see the target's IP address. cURL's %{remote_ip} gives the proxy's address, not the edge's. You recognize the edge from the headers. Many CDNs add a header with the edge's identity or region code. Via, X-Cache, Age and Server-Timing are common examples.

python
import requests

URL = "https://www.example.com/"
PROXY = "http://user:pass@pr.proxynet.io:8000"
HEADERS = ("Via", "X-Cache", "Age", "Server-Timing", "X-Served-By")

# Request the same URL directly first, then through the proxy
for label, proxies in [("local", None), ("proxy", {"http": PROXY, "https": PROXY})]:
    r = requests.get(URL, proxies=proxies, timeout=15)
    print(label, r.status_code, {h: r.headers[h] for h in HEADERS if h in r.headers})

If both lines show the same edge identity, there are two possibilities. Either the site uses anycast, or the name is resolved in the same place in both requests. The DNS answers from the first step tell you which.

Setup for geo-targeting

In country-targeted work, the goal is that the exit IP and the DNS answer point to the same region. Leave the name to the proxy and remove settings that force local resolution.

  • Pick the scheme. Use an HTTP proxy or socks5h://. Keep socks5:// for jobs where you deliberately want local resolution.
  • Clear fixed entries. Entries in the hosts file, and the cURL --resolve option used with socks5://, make the client send an IP to the proxy.
  • Verify each country. When you add a new country, run the two check steps once.
  • Keep the session fixed. Use a sticky session (1-60 minutes) to run the check and the actual job from the same exit. In rotating mode, each connection can get a different exit.

We explained how country and city selection is handled at the gateway in How Country and City Targeting Works in a Proxy.

Proxynet Residential Proxy works with HTTP and SOCKS5. To leave the name to the proxy side, write http:// or socks5h:// in the URL.

Troubleshooting

The symptom usually tells you the name was resolved in the wrong place. The table below maps the four most common cases.

SymptomLikely causeWhere to look first
Could not resolve host with the proxy onsocks5:// resolves the name locallyChange the scheme to socks5h://
Right country, but slowEdge picked for your regionCompare the DNS answers
Price or language from another countryRegional cache or subdomainEdge identity header
Edge identity same as localAnycast or resolution in the same placeDoH answer

How we tested

On December 1, 2026 we used cURL 8.23.0, Python 3.13.17 and Requests 2.34.2 on Windows 11. We set up three local servers: an HTTP proxy that logged the incoming target, a SOCKS5 server doing the same, and a small HTTP server that imitated an edge and added an X-Served-By header to its response. Only the proxy side could resolve the name edge.test; our machine's DNS did not know it.

  • The HTTP proxy received GET http://edge.test:8081/ for the plain request and CONNECT edge.test:8081 for the tunnel request. Both requests succeeded.
  • With socks5h://, the SOCKS5 server received a domain name (ATYP=3).
  • With socks5://, cURL failed with (6) Could not resolve host and Requests raised ConnectionError. The name never reached the proxy.
  • With --resolve, the socks5:// request delivered an IP address to the proxy. The same option had no effect on HTTP proxy and socks5h:// requests; the proxy still got the name.
  • In every request through a proxy, %{remote_ip} returned the proxy's address.
  • The header script printed the X-Served-By value on both lines.

We did not run the DoH command or requests to a real CDN from our test environment. Those results vary by site and location.

The bottom line

In country-targeted work, leave the name to the proxy side. For a new target, compare the DNS answer and the edge identity once locally and once through the proxy. If you use SOCKS5 Proxy, write socks5h:// in the URL. Above all, check the socks5:// scheme and hosts entries, because both silently make you land on the server for your own region.

Sources

Frequently asked questions

What is GeoDNS?

GeoDNS is a DNS method that returns a different IP address for the same domain depending on where the query comes from. The authoritative name server estimates the location from the address of the resolver forwarding the query, or from EDNS Client Subnet data. CDNs use it to send visitors to a nearby edge server. With a proxy, the estimate is only right if the name is resolved on the proxy side.

Who resolves DNS when using an HTTP proxy?

The proxy does. With an HTTP proxy, the client sends the target name inside the request: in the full URL for plain HTTP, in the CONNECT line for HTTPS. The proxy resolves the name with its own DNS and opens the connection. In our test, even cURL's --resolve option had no effect with an HTTP proxy. The proxy still received the domain name, not an IP address.

How does EDNS Client Subnet affect privacy?

To a limited degree. With ECS, the resolver passes part of the client address to the authoritative name server. RFC 7871 recommends 24 bits for IPv4 and 56 bits for IPv6. The full address is not sent, but the approximate network location is. A user who does not want this can set the source prefix length to zero, asking that no subnet data be sent at all.

If DNS resolves in the wrong country, does the site show the wrong country?

Usually not. Most edge servers set the country from the IP the connection comes from, which is the proxy exit. The main effect is extra latency, because the request goes to a distant edge. But on sites that use a regional cache, a region-specific subdomain or a redirect rule, prices, language or content from another country can appear.

Does DNS go through the proxy when a browser uses SOCKS5?

It depends on the browser. According to the Chromium documentation, Chrome always has the name resolved on the proxy side with a SOCKS5 proxy. With SOCKS4, the name is always resolved on the client. In Firefox, the "Proxy DNS when using SOCKS v5" option in the connection settings controls this. For country-targeted work, check that this option is turned on.

Does flushing the local DNS cache fix the problem?

No. Flushing the cache removes the old answer, but the name is still resolved on your device by your resolver. The new answer is also picked for your region. The cause is not the cache but where the name is resolved. The fix is to leave the name to the proxy side with an HTTP proxy or socks5h://.

Ask ChatGPTAsk Claude