Serverless DNS over HTTPS (DoH) at the Edge

Serverless DNS over HTTPS (DoH) at the Edge

Create a simple script named index.js that responds to all HTTP calls made to our worker:

The details of the script are beyond the scope of this article. Setting the above script aside for a moment, we’re going to configure Firefox to use DNS over HTTPS instead of its regular system default. So let’s create the new function:

This calls Google’s DNS over HTTPS server with the same body we were asked, logs it, and returns if it’s the expected content type.

Source: blog.stackpath.com