This topic explains how to add custom DNS records.
On the Custom DNS page, click Add DNS to add a custom DNS record for your domain name.
Add Policy Type
In the pop-up form, select Rule Strategy as the policy type to add a custom DNS rule policy.
You can configure the following settings:
Basic information
Parameter | Remarks |
Domain name | The domain name for which you want to customize the DNS, such as: www.aliyun.com. Note
|
Line | You can configure lines for carriers and regions.
Note Under the same domain name, for users in the same region, the priority of line effectiveness is: Carrier > Geographic location > Default. For example, Telecom-Beijing > Telecom-Default > Default-Beijing > Default-Default. For example: If there are two rule policies under the same domain name, with lines of Telecom-Beijing and Telecom-Default, the Telecom-Beijing line rule policy will be used for Telecom users in Beijing. |
Custom DNS rules
A rule policy supports up to 10 custom DNS rules.
Parameter | Remarks |
Rule name | Indicates the name of the current rule, which can be used to express the purpose of the rule, such as scheduling by SDK version. |
Rule order | The order of multiple rules can be adjusted. The matching logic is serial matching from top to bottom. The order determines which rule will be hit first. After adjusting the order, the new order will be used for matching. |
SDNS parameter configuration | Used to match the SDNS parameters carried by the client request parsing interface to determine whether the rule is hit. If the match is successful, the DNS record value in the rule is returned. For detailed matching logic, see Rule policy matching logic description .
Note
|
DNS record value | The return value collection of custom DNS. Each record value represents a DNS record in the record set, required.
You can add multiple record values. When weight scheduling is not enabled, the added multiple record values will be merged and returned together. You can also schedule by weight. Just turn on the weight scheduling switch. After enabling weight, you can set the weight for each record value. The weight value range is 1-100. According to the weight of the record value, a suitable record value is returned through the load balancing algorithm. Note A rule can add up to 10 record values. |
TTL | Required. The validity period of the custom DNS record. The shorter the validity period, the faster the DNS record cache in the HTTPDNS SDK expires. At the same time, the frequency of HTTPDNS SDK requests for new DNS records is higher. |
Verify whether the current policy meets expectations
The rule policy addition page allows you to verify rules, as illustrated below:
In the policy verification window, enter the relevant parameters to check if the current policy meets your requirements.
Add function compute policy
Prerequisites
A function must be created and published in the Function Compute console. For more information, see Create a new Function Compute service and .
A service-linked role must be authorized. For more information, see Authorize a service-linked role.
In the custom DNS addition drawer, selectFunction Compute Policy as the policy type to add a custom DNS Function Compute policy.
You can configure the following settings:
Parameter | Remarks |
Region | Select the region where the Function Compute service is located. For instance, if your Function Compute service is in the Singapore region, select Singapore. |
Service | Select the Function Compute service corresponding to the region. |
Service Version/Alias | Select the version or alias of the corresponding service. Using the LATEST version of Function Compute is not recommended. Note Using the LATEST version of Function Compute is not recommended. |
The Custom DNS Feature during the BEFORE_READ_CACHE Phase | Configure the Function Compute function for the pre-hook phase before reading the HTTPDNS server cache. Activation is optional. For a detailed explanation of the Function Compute policy hook, see the policy hook documentation. |
The Custom DNS Feature During the BEFORE_WRITE_CACHE Phase | Configure the Function Compute function for the pre-hook phase before writing to the cache after recursive resolution by the HTTPDNS server. Activation is optional. For more information, see the Function Compute policy hook description. |
Custom DNS Functionality During the BEFORE_WRITE_RESPONSE Phase | Configure the Function Compute function for the pre-hook phase before constructing the return content after writing to the cache by the HTTPDNS server. Activation is optional. For details on the Function Compute policy hook, see the policy hook documentation. |
Unit Testing for Hook Functions | Test the connectivity between the HTTPDNS service and the Function Compute service:
|
After configuring the settings above, click Confirm to return to the policy list.
For operations such as enabling, shutting down, or deleting policies, see Manage Custom DNS Policies and .