Dns-query endpoint is not correctly parsing "Accept" request header

Making JSON requests to the DNS endpoint https://cloudflare-dns.com/dns-query?name=ip.ayra.ch&type=AAAA is very flimsy and doesn’t seems to respect the syntax of the “Accept” client header.

Test

curl -H "Accept: application/dns-json" "https://cloudflare-dns.com/dns-query?name=ip.ayra.ch&type=A"
curl -H "Accept: application/dns-json, application/json;q=0.9, */*;q=0.8" "https://cloudflare-dns.com/dns-query?name=ip.ayra.ch&type=A"

Expected outcome

Both requests should succeed and return the dns resolution result as json, or at the very minimum, report what actually is wrong

Actual outcome

Any request where the “Accept” header is not the literal application/dns-json will fail silently without any cause of error given, even if the client specifies that type with the highest score.

Hi @AyrA,

Thanks for raising it. Confirming it’s a bug, and it is tracked internally now.

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