1. Introduction
This guide is for developers who want to integrate or evaluate the DNS over HTTPS (DoH) feature of Alibaba Cloud HTTPDNS. This guide covers the following:
The relationship between DoH and HTTPDNS and their applicable scenarios
The main steps for DoH integration
2. Comparison of DoH and HTTPDNS
In DNS over HTTPS (DoH), DNS queries and responses are transmitted over HTTPS. HTTPS encrypts the DNS data to prevent it from being intercepted or tampered with. Both HTTPDNS and DoH use an HTTP/HTTPS channel to bypass the local DNS resolution path of the operating system. This reduces the risk of domain hijacking and DNS pollution. The HTTPDNS product supports its proprietary protocol and the DoH protocol. These two protocols are suitable for different scenarios:
HTTPDNS protocol (proprietary protocol)
Advantages: Lightweight messages, easily extensible, and controllable flow. It supports features such as HTTP requests, identity authentication, service scheduling, and accelerated batch resolution.
Disadvantages: It requires some adaptation effort. This may require changes to your network library usage and affect its behavior.
DoH protocol ( RFC 8484 standard protocol)
Advantages: Fixed format, native support from some network libraries, and low adaptation cost. The behavior of the network library is consistent with local DNS.
Disadvantages: It lacks an authentication mechanism and is not extensible. The DoH request initiation and result cache policy of the network library cannot be modified or optimized.
You can use DoH for integration in scenarios where the client network library is closed-source and SDK integration is costly. DoH is the preferred method if the underlying framework provides a DoH configuration interface. Examples of such frameworks include CEF, Electron, and Qt WebEngine, which are based on the Chromium kernel.
The DoH protocol does not support passing business parameters. Therefore, it does not support custom parsing.
3. DoH integration steps
To integrate the DoH feature of HTTPDNS into a network library, follow these steps:
Apply the configuration to a network library or framework:
Integrating HarmonyOS applications with DoH
Integrate QT WebEngine with DoH
Integrate the CEF framework with DoH
Verify the integration: Set the DNS server for your mobile device's Wi-Fi network to an invalid address. Check whether business requests can still be initiated. If they can, the DoH integration is successful.
Alternatively, you can obtain IP addresses by making DoH requests directly without using a network library. For more information, see DoH API reference. This document describes Configure the DoH service, DoH API reference, and Integrate network libraries with DoH.