Reverse DNS in the Browser using DOH


How?

Whereas previously I would have had to setup some type of translation server or REST API to take an IP and return its reverse DNS to the client, this is done using the magic of DNS-over-HTTPS (DoH). Due to the fact that more and more DNS services are adding support for DoH, programmers can now make DNS requests from the browser assuming that the DoH server has Cross-origin resource sharing (CORS). Thankfully the amazing 1.1.1.1 DNS server offered by Cloudflare has the CORS header set so it can be used client-side. This site then takes the IP address and converts it into the corresponding in-addr.arpa for IPv4 addresses or ip6.arpa domain for IPv6 addresses and asks 1.1.1.1 for a PTR record for that domain. For more about this process I suggest you read the Wikipedia page here.