Troubleshooting 4 min read

Proxy DNS Resolution Errors: Could Not Resolve Host vs. Could Not Resolve Proxy

Two different machines can fail to resolve a name when you use a proxy: yours and the proxy's. Which one failed decides the fix.

Proxy DNS resolution errors come in two flavors, and telling them apart is most of the fix. Either your machine can't resolve the proxy's own hostname, or something (your machine or the proxy) can't resolve the website's hostname. curl even uses different error codes for them: "Could not resolve proxy" (error 5) and "Could not resolve host" (error 6). Which machine does the lookup for the website depends on the proxy protocol you chose, and that's where most confusion comes from.

Who Resolves What

  • The proxy hostname (global.nodeproxies.xyz) is always resolved by your machine. You have to find the proxy before you can talk to it.
  • With an HTTP proxy, the website's hostname is sent to the proxy (in the CONNECT line or the request URL), and the proxy side resolves it. Your machine never looks it up.
  • With socks5h://, the hostname is also sent to the proxy and resolved there.
  • With plain socks5://, your machine resolves the website's hostname first and sends the proxy only an IP address.

Error: Could Not Resolve Proxy

Your machine couldn't look up the proxy's hostname. The website isn't involved yet. Check:

# Does your DNS resolve the proxy host?
nslookup global.nodeproxies.xyz

# Try a public resolver to rule out your local DNS
nslookup global.nodeproxies.xyz 1.1.1.1
  1. Typos in the hostname. global.nodeproxies.xyz, not .com, and no http:// prefix in fields that expect a bare host.
  2. Local DNS failures. If the public resolver works and yours doesn't, your router, VPN or corporate DNS is the problem. Change DNS servers or ask your network admin.
  3. DNS filtering. Some networks and security tools block proxy-related domains. Try another network to confirm.
  4. Inside Docker, the container may have different DNS from the host. Run nslookup inside the container. See Docker proxy settings.

Error: Could Not Resolve Host (Through a SOCKS5 Proxy)

If you're using socks5:// and get "Could not resolve host", your machine tried to resolve the website and failed. The proxy never got the request. Switching to socks5h:// hands the lookup to the proxy:

# Local resolution (fails if your DNS can't resolve the site)
curl --proxy socks5://USERNAME:[email protected]:1080 https://example.com

# Remote resolution by the proxy (recommended)
curl --proxy socks5h://USERNAME:[email protected]:1080 https://example.com

The same applies in code. In Python requests with requests[socks] installed, and in Node's socks-proxy-agent, socks5h:// means remote resolution and socks5:// means local. Remote resolution is also more private, since your local DNS server never sees which sites you visit. More on that in DNS leaks and proxies.

Error: The Proxy Can't Resolve the Website

With an HTTP proxy or socks5h, if the website's hostname doesn't exist in public DNS, the proxy can't resolve it and the request fails, typically as a 502 on CONNECT or a SOCKS "host unreachable" reply. Common reasons:

  • The hostname is misspelled or the domain has expired. Check it with nslookup from your own machine.
  • It's an internal name (intranet.local, a Docker service name, something in your /etc/hosts file). Those only exist on your network; a remote proxy can't see them. Exclude them from the proxy with NO_PROXY or a bypass list.
  • The site uses split DNS and only resolves from certain networks.
  • A brand-new domain that hasn't propagated yet.

Excluding Internal Hosts from the Proxy

Most tools honor NO_PROXY (and lowercase no_proxy). Set it so local and internal names go direct while everything else uses the proxy:

export HTTP_PROXY=http://USERNAME:[email protected]:8080
export HTTPS_PROXY=http://USERNAME:[email protected]:8080
export NO_PROXY=localhost,127.0.0.1,.local,.internal,my-service

curl https://api.ipify.org     # goes through the proxy
curl http://my-service:3000     # goes direct

Exact NO_PROXY syntax varies a little between tools (leading dots, wildcards, CIDR ranges), so test each one you rely on. Git, npm and pip behind a proxy covers tool-specific settings.

Browser DNS Behavior

Chrome always lets an HTTP proxy resolve website hostnames. Firefox has a setting, "Proxy DNS when using SOCKS v5", that switches between local and remote resolution for SOCKS. If a site loads in one browser but shows a DNS error in another with the same proxy, compare these settings.

Geo Effects of Where DNS Happens

Large sites return different server addresses depending on where the DNS query comes from. With local resolution, you might connect through a German exit to a server chosen for your own location. Remote resolution (HTTP proxy or socks5h) keeps DNS consistent with the exit's location, which matters for localized content. Pair it with country targeting such as USERNAME-country-de; see proxy showing the wrong country.

DNS-Safe Setup with NodeProxies

Use the HTTP endpoint on global.nodeproxies.xyz:8080, or socks5h:// on port 1080, so website lookups happen on the proxy side. Exclude internal hosts with NO_PROXY. The proxy format converter builds the URLs; create an account for credentials.

FAQ

What does "could not resolve proxy" mean?

Your machine couldn't look up the proxy's hostname. Check the spelling and your local DNS, and try a public resolver.

What is the difference between socks5 and socks5h?

With socks5, your machine resolves the website's hostname. With socks5h, the proxy does. socks5h avoids local DNS failures and leaks.

Why can't my proxy reach localhost or internal hostnames?

A remote proxy resolves names on its own network, where your internal names don't exist. Add them to NO_PROXY so they bypass the proxy.

NodeProxies

Ready to get started?

90M+ residential, mobile & datacenter proxies. Datacenter from $0.30/GB, residential from $0.42/GB. No contracts.

Create free account