This topic describes how HTTPDNS custom resolution works and how to configure and use it.
About custom resolution
In your business scenarios, you might need to return specific DNS resolution results for a domain name. Use HTTPDNS custom resolution to achieve this. You can configure custom resolution using rules or Alibaba Cloud Function Compute.
Custom resolution is not supported for domains resolved over DNS over HTTPS (DoH).
Scenarios
Canary testing: Suppose your domain is
www.example.com. You launched a new service with IP address1.1.X.X. Before full rollout, you want to run a canary test for users in theChina Telecom Shanghairegion. For those users, DNS queries forwww.example.commust return1.1.X.X.Traffic routing: Suppose an automotive company uses
www.example.comas its service domain. It wants DNS resolution to return IP addresses of servers in different regions, based on business logic. For example, it returns the IP address of a server in Guangzhou for vehicles registered in Guangzhou. When a vehicle registered in Guangzhou querieswww.example.com, the DNS query returns the IP address of the Guangzhou server.
Overall usage flow
1. Add a domain
Log on to the EMAS console or the .
Choose Resolution Management > Domains. Add the domain that you want to resolve.

2. Add Custom Parsing
Choose Resolution Management > Custom Resolution. Click Add Custom Resolution.

Select the domain and choose a policy type:
3. Pass custom parameters from the client (optional)
When you send requests using the HTTPDNS SDK or HTTP API, include custom resolution parameters to enable fine-grained routing. For details, see Pass custom resolution parameters from the client.
4. Activate the policy
A policy does not take effect immediately after you add it. Turn on the toggle in the Status column to activate it.
Activating a policy is a critical operation. A confirmation dialog appears before activation. Risk control verification may also be required. If so, enter the CAPTCHA.

5. Validate resolution results
After configuration, test resolution results using the online test tool. For details, see Test custom resolution functions online.
6. Manage custom resolution policies (optional)
After you add a custom resolution policy, you can deactivate or delete it. For details, see Manage custom resolution policies.
Policy description
When to use each policy type
Use rule policies when: Your requirements are clear and the logic is simple. Examples include routing by ISP or region, or by device type. No real-time dynamic computation is needed.
Use Function Compute policies when: You need complex logic. Examples include load balancing, real-time decision making, or multi-condition evaluation.
Rule policies
A rule policy lets you define custom resolution behavior using matching rules. You can configure network lines in detail. By setting different resolution parameters, you route traffic from different ISPs and regions to different service endpoints.
Follow this procedure:
In the HTTPDNS console, create a custom resolution rule policy for a domain.
When the client sends a DNS query request using the SDK or HTTP API, include the required custom resolution parameters.
The HTTPDNS server receives the request and returns the best-matching resolution result based on your rules.
For step-by-step instructions, see Configure rule-based custom resolution.
The rule policy resolution flow is shown here:
Function Compute policies
A Function Compute policy links to Alibaba Cloud Function Compute to route domain traffic. It is more flexible than rule policies. Write your business logic in a Function Compute function. Then configure that function as the resolution hook. This supports complex business needs. For step-by-step instructions, see Configure Function Compute–based custom resolution.
The Function Compute architecture is shown here:

