Building a Custom DNS using CF Workers

I am pretty sure that the answer is NO but I want to make sure before I go down another route.

We want to build a DNS service on CF Workers which will resolve a requested URL to a local IP address. Here is a simple example.

  1. The browser (client) requests the resolution of a URL. For example browser requests a DNS resolution of
  2. Assume that the DNS of the client/browser is configured to use the WebWorker DNS service as the DNS service
  3. The DNS request triggers the WebWorks which using basic JS will return the IP address of

The reason we want this is we want the client browser to see the local as a trusted destination and not issue that horrible security warning like Chrome browser does.

Is this possible using Workers?


Not possible since DNS works on UDP/TCP packets and Workers are HTTP & WebSocket only.

Why not just use the normal Cloudflare DNS? It can happily issue RFC 1918 addresses?


1 Like

You can build DNS over HTTPS with a Worker.

Brilliant suggestion. I dont know why I didnt think of the most obvious solution.

So I guess it would be something like

  1. Server App registers with our server
  2. Our server will use the CF API to create a DNS entry for this device which resolves to a local IP address
  3. The browser client will request and CF will resolve that to the local IP

I cant wait to try it. Thank you for the suggestion.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.