Cloudflare respects DNS wireformat as defined in RFC 1035 ↗.
To send queries using DNS wireformat, set the header accept: application/dns-message, or content-type: application/dns-message if using POST to signalize the media type of the query.
Queries using DNS wireformat can be sent using POST or GET.
Using POST
When making requests using POST, the DNS query is included as the message body of the HTTP request, and the MIME type (see below) is included in the Content-Type request header. Cloudflare will use the message body of the HTTP request as sent by the client, so the message body should not be encoded.
The following is an example request. The same DNS query for www.example.com, using the POST method would be:
And would return the answer in wireformat:
To try this using cURL, write:
Using GET
When making requests using GET, the DNS query is encoded into the URL. The accept header can be used to indicate the MIME type (default: application/dns-message).