A Cloudflare Worker that proxies DNS-over-HTTPS requests with enhanced performance, reliability, and security
Use this URL as your DNS-over-HTTPS resolver
Leverages Cloudflare's global edge network for minimal latency and maximum performance.
Intelligently distributes requests across multiple DNS providers based on configurable weights.
Seamlessly switches to backup providers when primary ones experience issues.
This proxy supports both general DNS providers and ad-blocking focused providers for enhanced privacy and security.
Use this worker as a DoH endpoint:
For GET requests, the DNS query must be base64url-encoded as per the RFC 8484 specification:
Why base64url encoding?
Detailed DNS Encoding Explanation
Example with curl:
For POST requests, the DNS query is sent as binary data in the request body:
Example with curl:
To avoid base64 encoding entirely, use POST requests with the Content-Type: application/dns-message
header. The DNS query is sent as raw binary data in the request body:
This worker automatically balances requests across multiple DNS providers based on the configured weights. All DNS responses are cached for 5 minutes to improve performance.
For CORS support, the worker includes the following headers in all responses: