HTTPDNS supports three connection types: Method 1: SDK-based access, Method 2: Access by calling the JSON API, and Method 3: DoT/DoH-based access.
For Method 1: SDK-based access and Method 2: Access by calling the JSON API, you must create a key to authenticate the connection. Before you begin, create a key.
Method 1: SDK-based access
Scenarios: This method is used to prevent domain name resolution hijacking for mobile apps and IoT devices. You can connect by integrating the SDK. The result is the same as a standard HTTPDNS integration.
Download the SDK for your target operating system, either Android or iOS.
Integrate the SDK into your app. For more information, see:
After the integration is complete, verify the connection in the Alibaba Cloud DNS console. Go to the Dashboard > Resolution Dashboard > HTTPDNS page. The connection is successful if traffic data is displayed.
Method 2: Access by calling the JSON API
Scenarios: Use this method if you cannot use an SDK. You can use the native API to make resolution requests directly.
The DoH JSON API provides the following URL endpoints. Both TLS and non-TLS connections are supported.
https://223.5.5.5/resolve?name=domain_name&type=record_type&uid=AccountID&ak=AccessKey ID&key=****&ts=timestamp
http://223.5.5.5/resolve?name=domain_name&type=record_type&uid=AccountID&ak=AccessKey ID&key=****&ts=timestamp
https://223.6.6.6/resolve?name=domain_name&type=record_type&uid=AccountID&ak=AccessKey ID&key=****&ts=timestamp
http://223.6.6.6/resolve?name=domain_name&type=record_type&uid=AccountID&ak=AccessKey ID&key=****&ts=timestamp
For more information, see DoH JSON API.
Method 3: DoT/DoH-based access
Scenarios: Use this method for clients such as browsers and mobile phones. This method does not support authentication and is not recommended.
You can connect using one of the following two formats. The user_id is the Unique configuration ID from the console.
1. Short address connection (low security, not recommended)
For DNS over TLS (DoT), configure the following address: <user_id>.alidns.com
For DNS over HTTPS (DoH), configure the following address: https://<user_id>.alidns.com/dns-query
Keep your Account ID secure. A leaked Account ID poses a security threat and can result in fraudulent data usage.
2. Custom address connection
This method is recommended because you can customize the connection address for higher security, which helps prevent fraudulent use of your data.
For DoT, configure the following address: <user_id>-custom_field.alidns.com
For DoH, configure the following address: https://<user_id>-custom_field.alidns.com/dns-query
To enable DoT/DoH connections, you must turn on the switch manually.
If the DoH/DoT Enabled Status is off, resolution requests are rejected.
For more information about the DoT interface, see DNS over TLS (DoT).
For more information about the DoH interface, see DNS over HTTPS (DoH).