All Products
Search
Document Center

HTTPDNS:Add custom resolution records

Last Updated:Oct 16, 2025

This topic describes how to add custom resolution records.

On the Custom Resolution page, click Add Custom Resolution to add a custom resolution record for a domain name.

Add a rule policy

In the panel that appears, set the Policy Type parameter to Rule Policy to add a rule policy.

Configure the parameters.image

Basic information

Parameter

Description

Domain Name

The domain name that you want to resolve. Example: www.aliyun.com.

Note
  • The domain name dropdown list is populated with domain names from the Added Domain Names page. If the domain name that you want to add a custom resolution record for is not in the dropdown list, you can add it to the domain name list and then add the custom resolution record for it.

  • If you want to add a custom resolution record for a subdomain of a wildcard domain such as *.aliyun.com, but the subdomain that you want to resolve is a.aliyun.com, you must first add a.aliyun.com to the domain name list. Then, add a custom resolution record for the subdomain.

  • Scenarios in which you cannot select the required domain name in the drop-down list:

    • The domain name is not in the list of added domain names. You can add the domain name in Added Domain Names.

    • The domain name is a subdomain of a wildcard domain name. Add the subdomain to the list.

    • The domain name already has a custom resolution record. Go to the custom resolution record list to manage the domain name.

ISP Line

The line settings based on your Internet service provider (ISP) and region.

  • Carrier: You can specify a carrier, such as China Telecom.

    • If you set the ISP parameter to Default, all ISP lines are used.

  • Geographical Location: You can customize provinces, such as Beijing and Hebei. Only provinces in the Chinese mainland are supported.

    • If you select Default, the specified line covers all provinces.

Note

For the same domain name in one region, the line settings take effect in the following order of priority: ISP > Geographical Location > Default. For example: China Telecom-Beijing > China Telecom-Default > Default-Beijing > Default-Default.

If two rule policies are created for the same domain name with lines set to China Telecom-Beijing and China Telecom-Default, China Telecom-Beijing takes precedence for China Telecom users in Beijing. This means that the rule policy with the China Telecom-Beijing line is applied to the users.

Custom resolution rules

You can configure up to 10 custom resolution rules for a rule policy.

Parameter

Description

Rule Name

The name of the rule, which can be used to describe the purpose of the rule. Example: Perform scheduling using SDK versions.

Rule Sorting

The order of multiple rules, which can be adjusted. The matching logic follows a top-down sequential process. The order determines which rule is matched first. After you adjust the order, the system applies the rules in the new order.

SDNS Parameter Configuration

The configurations used to match the software-defined DNS (SDNS) parameters carried in client requests. If a rule is matched, the system returns the resolution record value of the rule. For more information about the matching logic, see Matching logic of a custom resolution rule .

  • Parameter name: the name of the SDNS parameter. Must be 2 to 64 characters in length.

  • Parameter value: the value of the SDNS parameter. Must be 1 to 64 characters in length.

Note
  • You can add up to 10 SDNS parameters to a rule.

  • You can add SDNS parameters to a resolution API operation. For more information, see Add SDNS parameters .

Resolution Record Value

The set of returned values for custom resolution. Each record value indicates a record in the resolution record set. This parameter is required.

  • Record type: the type of the returned resolution record value. A and AAAA records are supported.

  • Record value: the returned record value.

You can add multiple record values. If you disable weight settings, multiple record values are merged and returned.

To perform scheduling based on weights, you must turn on the corresponding switch. After you turn on the switch, you can specify a weight for each record value. The weight value ranges from 1 to 100. An appropriate record value is returned using a load balancing algorithm based on the weight of the record value.

Note

You can add up to 10 record values to a rule.

TTL

Required. The validity period of the custom resolution record. A shorter validity period results in quicker expiration of the resolution record cache in the HTTPDNS SDK. Meanwhile, the frequency at which the HTTPDNS SDK requests new resolution records increases.

Test the rule policy

On the Add Rule Policy page, you can validate the rule as shown in the following figure.image

In the dialog box that appears, configure the parameters to check whether the rule policy meets your business requirements.

image

Add a Function Compute policy

Prerequisites

In the Add Custom Resolution panel, set the Policy Type parameter to Function Compute Policy to add a custom resolution Function Compute policy.

image

Configure the parameters.

Parameter

Description

Region

Required. Select the region where the Function Compute service resides. If you create a Function Compute service in the Shanghai region, select Shanghai.

FC Version

Both FC 2.0 and FC 3.0 function configurations are supported. The default is FC 3.0, which is recommended.

Differences and compatibility between Function Compute 3.0 and 2.0

Service

Required. Select the Function Compute service that is created in the selected region. This field is available only for FC 2.0.

Service Version/Alias

Required. Select the version or alias of the Function Compute service. This field is available only for FC 2.0.

Note

We recommend that you do not select the LATEST version of Function Compute.

Custom Resolution Function in the BEFORE_READ_CACHE Phase

During the hook stage before the cache is read from the HTTPDNS server, you can configure a Function Compute function at this phase. You can also leave the hook functionality for this phase inactive.

Learn more about Function Compute policy hooks

Custom Resolution Function in the BEFORE_WRITE_CACHE Phase

During the hook stage after recursive resolution by the HTTPDNS server but before writing to the cache, you can configure a Function Compute function at this phase. You can also leave the hook functionality for this phase inactive.

Description of Function Compute policy hooks

Custom Resolution Function in the BEFORE_WRITE_RESPONSE Phase

During the hook stage after the HTTPDNS server writes to the cache but before constructing the response content, you can configure a Function Compute function at this phase. You can also leave the hook functionality for this phase inactive.

Learn more about Function Compute policy hooks

Hook Unit Testing

Test the connectivity between HTTPDNS and the Function Compute service:

  • Successful: HTTPDNS can connect to the configured Function Compute service.

  • Failed: HTTPDNS cannot connect to the configured Function Compute service.

After you complete the configurations, click OK to return to the policy list.

For more information about how to enable, disable, and delete a policy, see Manage custom resolution policies.