4 ms·
> You can't make DNS query from browser JavaScript AFAIK. Yes, you can. [1] Lots of public DNS resolvers have support for it, too. [2] Example: fetch('https:
by cookiengineer 5y ago
> You can't make DNS query from browser JavaScript AFAIK.
Yes, you can. [1] Lots of public DNS resolvers have support for it, too. [2]
Example:
fetch('https://cloudflare-dns.com/dns-query?name=example.com&type=AAAA https://cloudflare-dns.com/dns-query?name=example.com&type=A...', { method: 'GET', headers: new Headers({ 'accept': 'application/dns-json' })});
Note that this is the JSON-specific format [3]. DNS over HTTPS itself uses the DNS wireformat [4], so you would have to build a parser for that if you want to integrate it into a web app.
[1] https://developers.google.com/speed/public-dns/docs/doh/json https://developers.google.com/speed/public-dns/docs/doh/json
[2] https://developers.cloudflare.com/1.1.1.1/encrypted-dns/dns-over-https/make-api-requests/dns-json https://developers.cloudflare.com/1.1.1.1/encrypted-dns/dns-...
[3] https://www.rfc-editor.org/rfc/rfc8427 https://www.rfc-editor.org/rfc/rfc8427
[4] https://datatracker.ietf.org/doc/html/rfc8484 https://datatracker.ietf.org/doc/html/rfc8484
- capableweb 5y agoThat's a HTTP request no matter what data is being returned. Fact still stands that there is no JS API in browsers to make proper DNS requests (without HTTP).
- kube-system 5y agoSome might argue that DoH is proper DNS. Port 53 DNS sucks.
- LinuxBender 5y agoDoH in its current implementation is just a tunnel using https to reach someone elses centralized servers that are using port 53 DNS. The root servers do not yet support DoH/DoT and I would be pleasantly surprised if they ever did.
- kube-system 5y agoMost of us are on the other end of the DNS hierarchy, and send queries to recursive resolvers, not root servers. Root server operators are conservative and there's much less of privacy consideration when traffic is mixed with others at a resolver.