Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can't make DNS query from browser JavaScript AFAIK.


> 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=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

[2] https://developers.cloudflare.com/1.1.1.1/encrypted-dns/dns-...

[3] https://www.rfc-editor.org/rfc/rfc8427

[4] https://datatracker.ietf.org/doc/html/rfc8484


That'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).


Some might argue that DoH is proper DNS. Port 53 DNS sucks.


DoH 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.


Most 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.


ahha




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: