Query Google Public DNS’s JSON API Through an HTTP Proxy
Retrieve DNS records over a proxied HTTPS request while keeping the resolver API distinct from the proxy’s own hostname lookup.
An HTTP proxy can carry a request to a DNS-over-HTTPS service. For Google Public DNS’s JSON interface, an explicit query can be:
curl --fail --proxy http://proxy.example.net:8080 --noproxy "" \
--get --data-urlencode "name=example.net" \
--data-urlencode "type=A" \
https://dns.google/resolve
The proxy carries the HTTPS connection to dns.google. The HTTP proxy list is one place to select a candidate for this public query, where public-proxy access is permitted. Google’s resolver answers the name parameter. This is not a request for the proxy to return its own DNS cache, nor a change to the DNS configuration used by other applications.
Read the JSON Status and returned records, not only the HTTP status. A successfully delivered HTTP response can describe a DNS failure. Change type to the required record, such as AAAA or MX; one A query is not a complete inventory of every record type.
This endpoint’s JSON format is a documented Google API. Standard DoH wire-format clients use DNS messages and application/dns-message instead. An ordinary nslookup invocation does not acquire either HTTP interface simply because HTTPS_PROXY is set.