What is the name of the domain?
What is the issue you’re encountering
When use DoH to get dns record, the response content is differ from before
What steps have you taken to resolve the issue?
We’ve configured a DNS TXT record for endpoints.adm.allxon.com
to provide API endpoint information.
The record’s data is a JSON string, originally formatted as follows:
"api-v1={\"region\":\"GLOBAL\",\"endpoints\":{\"API\":[\"api.adm-dev.allxon.com\"]}}"
We use Cloudflare’s DoH, https://cloudflare-dns.com/dns-query?name=endpoints.adm.allxon.com&type=TXT
with the Accept: application/dns-json
header, to retrieve this information.
This has been working reliably, but we’ve recently encountered a change in the response format that’s impacting our service.
Here’s the current response from Cloudflare’s DoH service:
{
"Status": 0,
"TC": false,
"RD": true,
"RA": true,
"AD": true,
"CD": false,
"Question": [
{
"name": "endpoints.adm.allxon.com",
"type": 16
}
],
"Answer": [
{
"name": "endpoints.adm.allxon.com",
"type": 16,
"TTL": 300,
"data": "\"api-v1={\\\"region\\\":\\\"GLOBAL\\\",\\\"endpoints\\\":{\\\"API\\\":[\\\"api.adm.allxon.com\\\"]}}\""
}
]
}
Comparing this to a previous, correct response from our logs:
{
"Status": 0,
"TC": false,
"RD": true,
"RA": true,
"AD": true,
"CD": false,
"Question": [
{
"name": "endpoints.adm.allxon.com",
"type": 16
}
],
"Answer": [
{
"name": "endpoints.adm.allxon.com",
"type": 16,
"TTL": 300,
"data": "\"api-v1={\"region\":\"GLOBAL\",\"endpoints\":{\"API\":[\"api.adm-dev.allxon.com\"]}}\""
}
]
}
We’ve also tested with Google’s DoH (dns.google
):
{
"Status": 0,
"TC": false,
"RD": true,
"RA": true,
"AD": true,
"CD": false,
"Question": [
{
"name": "endpoints.adm.allxon.com.",
"type": 16
}
],
"Answer": [
{
"name": "endpoints.adm.allxon.com.",
"type": 16,
"TTL": 300,
"data": "api-v1={\"region\":\"GLOBAL\",\"endpoints\":{\"API\":[\"api.adm.allxon.com\"]}}"
}
],
"Comment": "Response from 205.251.198.198."
}
The key difference is in the escaping of the JSON string within the TXT record’s data
field.
Previously, backslashes (\
) were used to escape the inner double quotes within the JSON.
Now, Cloudflare’s DNS service is returning the JSON with triple backslashes (\\\
).
This change breaks our service. Our code expects the original escaping and is unable to correctly parse the JSON when it contains the triple backslashes.
Google’s DNS, as you can see, returns the original, correctly escaped JSON.
Could you please investigate this change and, if possible, revert to the previous escaping mechanism (single backslashes)?
This would greatly help restore our service functionality.
We understand that changes happen, and we appreciate your prompt attention to this issue.
Thank you for your assistance!
What feature, service or problem is this related to?
DNS records