---
title: "How Does DNS over HTTPS Work with a Proxy? Where Queries Go"
description: "With a proxy on, DoH only covers names the device resolves; with an HTTP proxy or socks5h the proxy resolves the target. Firefox, Chrome, curl and a test."
url: https://proxynet.io/blog/dns-over-https-and-proxy
date: 2026-12-03
author: "Acar Diveroli"
category: "Networking"
lang: en
---

# How Does DNS over HTTPS Work with a Proxy? Where Queries Go

DNS over HTTPS (DoH) is a way of sending a DNS query inside an encrypted HTTPS request. With a proxy on, this setting only applies to names the device resolves itself. With an HTTP proxy or SOCKS5 with remote DNS, the proxy resolves the target name and DoH never comes into play. The trap is a `socks5://` setup: the name is resolved over DoH, but the DoH request can go out directly without entering the proxy. This post covers the path of a DoH request, how Firefox, Chrome and curl behave, and how to test which resolver the outside world sees.

> **Note: Short answer**
>
> With a proxy on, DoH only works for names the device resolves itself: the proxy server's name and targets resolved locally with `socks5://`. With an HTTP proxy or `socks5h://`, the proxy resolves the target name, and the browser's DoH setting has no part in that lookup.

## The path of a DoH request

A DoH query is an ordinary HTTPS request. Under RFC 8484, the client puts the DNS message in a POST body with the `application/dns-message` type. Or it encodes the message with base64url and writes it into the `dns` parameter of a GET request. An observer on the network only sees a TLS connection to the DoH server.

So a DoH request can technically pass through a proxy. Whether it does is up to the client. In our test, curl opened the DoH connection directly, ignoring the proxy setting. The DoH provider saw the query coming from our own IP.

A client that uses a proxy performs three separate name lookups:

| Name being resolved | Who resolves it | Role of DoH |
|---|---|---|
| Target site (`example.com`) | Depends on the proxy type | Only with local resolution |
| Proxy server (`pr.proxynet.io`) | The device | Over DoH if DoH is on |
| The DoH server's own name | The device's system DNS | None |

The last row is a bootstrap problem. According to the curl documentation, the DoH server's name is found with the normal resolver by default. To avoid that, pass the address by hand with `--resolve`.

## DoH by proxy type

The proxy scheme decides who resolves the target name. With an HTTP proxy, the client sends a `CONNECT example.com:443` line and the proxy resolves the name. With SOCKS5, the client sends either the name or an IP it resolved itself. We cover the difference between the two schemes in [SOCKS5 vs SOCKS5H](/blog/socks5h-vs-socks5-dns). Here we only look at the effect on DoH.

| Setup | Who resolves the target | Does DoH apply to the target |
|---|---|---|
| HTTP proxy | Proxy | ✗ |
| `socks5h://` or remote DNS | Proxy | ✗ |
| `socks5://` or local DNS | Device | ✓ |
| No proxy | Device | ✓ |

If the proxy resolves the target, the browser's DoH setting does not encrypt that lookup. No DNS query leaves the device. The name travels inside the connection to the proxy and is sent to the resolver on the proxy side.

The only proxy setup in which DoH resolves the target name is `socks5://`. In that case the DoH provider may see the query from your IP, not from the proxy exit. The name is resolved for your location, while the connection goes through the proxy. If you see this mixed result, the problem is the scheme.

## TRR settings in Firefox

Firefox calls DoH TRR (Trusted Recursive Resolver) and keeps its settings under `network.trr.*`. The main preference is `network.trr.mode`. `2` tries DoH first and falls back to system DNS on failure. `3` uses DoH only and never falls back. `5` turns DoH off by user choice.

With SOCKS5, the deciding preference is `network.proxy.socks5_remote_dns`. The "Proxy DNS when using SOCKS v5" checkbox in Connection Settings maps to this preference. According to MDN, the default for SOCKS5 has been `true` since Firefox 128 and was `false` before. While the value is `true`, the proxy resolves the target name and TRR applies only to the proxy's own name.

If the value is `false`, Firefox resolves the target itself. With TRR on, that query goes over DoH. Old profiles or hand-edited settings still show this case.

One more detail. At Firefox's default protection level, the checks that turn on DoH automatically leave it off if they detect a proxy in the operating system. Firefox logs this skip with the reason `TRR_HEURISTIC_TRIPPED_PROXY`. If you turned DoH on yourself, this check does not apply.

The `about:networking#dns` page shows which names were resolved over DoH. Its TRR column reads `true` for names resolved over DoH. If the target site's name shows `true` there, it was resolved locally and SOCKS5 remote DNS is off. We did not test Firefox for this post; this section is based on Mozilla's documentation.

## Secure DNS in Chrome

Chrome's DoH setting is called "Use secure DNS" and sits on the Security page under Privacy and security. According to the Chromium documentation, name resolution is always left to the proxy with an HTTP proxy. With SOCKS5 too, the name is always resolved on the proxy side. Chrome has no option to change this; local resolution only happens with SOCKS4.

So in Chrome, secure DNS has no effect on target sites while a proxy is on. Where the setting matters is the proxy server's name. Chrome first resolves a name like `pr.proxynet.io` itself, then connects to the proxy.

We tried this with Chrome 158. In a test profile, we pinned secure DNS to an unreachable DoH address. The profile was in secure mode, so fallback to system DNS was off.

| Scenario (broken DoH address) | Result |
|---|---|
| No proxy | ✗ Page did not load |
| HTTP proxy, by IP address | ✓ Loaded, the proxy received `CONNECT example.com:443` |
| SOCKS5 proxy, by IP address | ✓ Loaded, the proxy received the domain name |
| HTTP proxy, by domain name | ✗ The proxy's name could not be resolved |

The last row matters in practice. If you picked a custom provider in secure DNS and that provider is unreachable, the proxy's name does not resolve and no page loads.

## --doh-url and a proxy in curl

In curl, DoH is turned on with the `--doh-url` option and applies to every name lookup curl makes. Used together with a proxy, the scheme again decides the outcome.

```bash
# HTTP proxy: the proxy resolves the target, DoH only for the proxy name
curl -x "http://user:pass@pr.proxynet.io:8000" \
  --doh-url https://dns.google/dns-query \
  https://example.com/

# socks5: curl resolves the target over DoH, an IP goes to the proxy
curl -x "socks5://user:pass@pr.proxynet.io:8000" \
  --doh-url https://dns.google/dns-query \
  https://example.com/

# socks5h: the proxy resolves the target, DoH only for the proxy name
curl -x "socks5h://user:pass@pr.proxynet.io:8000" \
  --doh-url https://dns.google/dns-query \
  https://example.com/
```

We ran the three commands through our local test proxies. Then we pointed the DoH address at a port with nothing listening and ran them again:

| Scheme | Target in the proxy log | With a broken DoH address |
|---|---|---|
| `http://` | `CONNECT example.com:443` | ✓ 200 |
| `socks5://` | IPv6 address | ✗ `curl: (6) Could not resolve host` |
| `socks5h://` | Domain name `example.com` | ✓ 200 |

In all three cases the DoH connection did not enter the proxy. The `[DoH]` lines in the `-v --trace-config doh` output showed a direct connection to the DoH server. When we gave the proxy by domain name and used a broken DoH address, curl stopped with `(5) Could not resolve proxy`.

If you write `socks5://` together with `--doh-url`, the DoH provider sees the target name from your IP. If you want the target resolved on the proxy side, write `socks5h://`. With [SOCKS5 Proxy](https://proxynet.io/socks5-proxy), this scheme carries the domain name to the proxy as is.

## Testing the visible resolver

You can see which IP a DoH request comes from with a special Google Public DNS record. The TXT record of the name `o-o.myaddr.l.google.com` returns the address of the side that sent the query. Call the JSON endpoint through the proxy:

```bash
curl -s -x "http://user:pass@pr.proxynet.io:8000" \
  "https://dns.google/resolve?name=o-o.myaddr.l.google.com&type=TXT"
```

The answer contains two TXT values. The value that starts with `edns0-client-subnet` is the subnet Google derived from the IP that sent the request. If that subnet belongs to the proxy exit, the DoH request went through the proxy. If it is your own network's subnet, DoH went out directly. The other value is the address of Google's own resolver that queries the authoritative name server.

In a browser, the same question is answered by local resolution. In Firefox, check the `about:networking#dns` table. In Chrome, repeat the broken DoH test above in a separate test profile. If the page loads with the proxy on, target names are not being resolved locally.

Which location a name is resolved for is a separate question. We cover the CDN and GeoDNS side in [How DNS Resolution Affects Proxy Location](/blog/proxy-dns-resolution-location).

## Troubleshooting

Most errors with DoH and a proxy together come from two places: a target resolved locally and the proxy's own name. Match the symptom against the table below.

| Symptom | Likely cause |
|---|---|
| `curl: (6) Could not resolve host`, only with `socks5://` | DoH server unreachable, target resolved locally |
| `curl: (5) Could not resolve proxy` | The proxy's name could not be resolved over DoH |
| Chrome with a proxy on, no page loads | Custom provider in secure DNS is unreachable |
| Target names show TRR `true` in Firefox | SOCKS5 remote DNS is off |
| `edns0-client-subnet` shows your own network | The DoH request does not enter the proxy |

When the proxy's name cannot be resolved, first check access to the DoH provider. If you use mode `3` in Firefox, switch to `2` temporarily; if the problem goes away, the DoH server is the cause.

## How we tested

We ran the tests on 3 December 2026 on Windows 11. Versions: curl 8.23.0, Google Chrome 158.0.8127.107, Node.js 24.22.2. A local HTTP proxy we wrote in Node logged every `CONNECT` line. A local SOCKS5 server logged the address type of each request (domain name, IPv4, IPv6) and relayed the connection.

The target was `example.com` and the DoH server was Google Public DNS. In the broken DoH scenario we used an address pointing to a local port with nothing listening. In the scenario where we gave the proxy by domain name, we used a public name that resolves to `127.0.0.1`. We ran Chrome headless with a separate test profile and set secure DNS to secure mode in the profile's settings file. We did not test Firefox.

## The bottom line

When you use a proxy, leave the target name to the proxy: an HTTP proxy or `socks5h://`. DoH then only resolves the proxy's name, and that is enough. Above all, avoid using `socks5://` together with DoH, because the name is resolved from your IP and for your location. With a geo-targeted [Residential Proxy](https://proxynet.io/residential-proxy), that difference shows up directly in the results.

## Sources

- [RFC 8484, DNS Queries over HTTPS (DoH), section 4.1](https://www.rfc-editor.org/rfc/rfc8484#section-4.1): rfc-editor.org
- [Chromium, Proxy support in Chrome, SOCKSv5 proxy scheme](https://chromium.googlesource.com/chromium/src/+/HEAD/net/docs/proxy.md): chromium.googlesource.com
- [Firefox Source Docs, DNS over HTTPS (Trusted Recursive Resolver)](https://firefox-source-docs.mozilla.org/networking/dns/dns-over-https-trr.html): firefox-source-docs.mozilla.org
- [MDN, proxy.settings, proxyDNS](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/settings): developer.mozilla.org
- [curl man page, --doh-url](https://curl.se/docs/manpage.html#--doh-url): curl.se

## Frequently asked questions

### Does DoH work with a proxy on?

Partly. DoH only works for names the device resolves itself. With an HTTP proxy or `socks5h://`, the proxy resolves the target name and no DNS query leaves the browser. In that case DoH only resolves the proxy server's name. With `socks5://`, the name is resolved locally, so DoH also applies to target names, but the query may not go through the proxy.

### Does a DoH query go through the proxy?

It depends on the client. DoH is an ordinary HTTPS request, so technically it can pass through a proxy. In our test, curl 8.23.0 connected directly to the server given with `--doh-url`, regardless of the proxy setting. In Chrome with a proxy on, the only name left to DoH was the proxy's own name. Check your own setup with the `o-o.myaddr.l.google.com` test.

### What should network.trr.mode be in Firefox?

It depends on the goal. `2` tries DoH first and falls back to system DNS on failure. `3` uses DoH only; if the DoH server is unreachable, names do not resolve. `5` turns DoH off. When working with a proxy, the setting that matters is `network.proxy.socks5_remote_dns`. When it is `true`, the proxy resolves target names and the TRR mode only affects the proxy's name.

### Does secure DNS in Chrome affect the proxy setting?

Not for target sites. With HTTP and SOCKS5 proxies, Chrome always leaves the target name to the proxy, and no option changes that. Secure DNS is only used to resolve the proxy server's name. If the custom provider is unreachable, the proxy's name does not resolve and no page loads. Chrome 158 showed this behavior in our test.

### Does DoH prevent DNS leaks?

Not on its own. DoH hides the query from your internet provider, but the DoH provider sees the query and your IP. If you use `socks5://` with DoH, the target name is resolved from your address, not from the proxy exit. What closes the leak is leaving the name to the proxy. For other leak paths in the browser, see [WebRTC and DNS Leaks](/blog/webrtc-dns-leak).

### How do I use DoH and a proxy together in curl?

Put the `-x` and `--doh-url` options in the same command. With the `socks5h://` scheme, the proxy resolves the target and DoH only resolves the proxy's name. If you write `socks5://`, the target is also resolved locally over DoH and the DoH provider sees your IP. The DoH server's own name is found with the normal resolver by default; you can pin it with `--resolve`.
