Reverse DNS in the Browser using DOH


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 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 for IPv4 addresses or domain for IPv6 addresses and asks for a PTR record for that domain. For more about this process I suggest you read the Wikipedia page here.