After you call the BatchSetDcdnDomainConfigs operation to configure features for a domain name, a unique configuration ID (ConfigId) is generated. You can use this configuration ID to update or delete settings. This topic describes how to generate, query, and use a configuration ID.
Usage notes on ConfigId
Feature | Description |
---|---|
Generate a configuration ID | Call the BatchSetDcdnDomainConfigs operation. If the operation succeeds, a configuration ID is generated. |
Query configuration IDs | Call the DescribeDcdnDomainConfigs operation. If the operation succeeds, a configuration ID is returned. |
Use a configuration ID to update settings | Call the BatchSetDcdnDomainConfigs operation to update settings based on a specified configuration ID. |
Use a configuration ID to delete settings | Call the DeleteDcdnSpecificConfig operation to delete settings based on a specified configuration ID. |
Generate a configuration ID
-
Configure a single feature rule: Call the BatchSetDcdnDomainConfigs operation to configure a single feature rule for a domain name. If the operation succeeds, a configuration ID is returned.
Scenario: The domain name
example.com
is used as an example. Enable Dynamic Route for CDN (DCDN) nodes to inform clients that the content returned to the clients does not need to be cached.Example: Set the set_resp_header parameter for the domain nameexample.com
: key=Cache-Control,value=no-cache. Sample request:action: BatchSetDcdnDomainConfigs params: { "Functions": [{ "functionArgs": [{ "argName": "value", "argValue": "no-cache" }, { "argName": "key", "argValue": "Cache-Control" } ], "functionName": "set_req_header" }], "domainNames": "example.com" } product: dcdn
If the operation succeeds, a configuration ID is returned.{ "code": "200", "data": { "DomainConfigList": { "DomainConfigModel": [ { "FunctionName": "set_req_header", "DomainName": "example.com", "ConfigId": 19571990834**** } ] }, "RequestId": "4FF61A1D-E697-5E6C-9E5D-7D1E1529****" }, "httpStatusCode": "200", "requestId": "4FF61A1D-E697-5E6C-9E5D-7D1E1529****", "successResponse": true }
-
Some features support more than one rule. The following example shows how to add multiple rules at a time:
Example: Set the set_resp_header parameter for the domain nameexample.aliyundoc.com
and add the following two rules:- Rule 1: Enable DCDN nodes to inform clients that the content returned to the clients
does not need to be cached.
Parameter settings: key=Cache-Control,value=no-cache.
- Rule 2: Enable DCDN nodes to inform clients that the content returned to the clients
is of the text type.
Parameter settings: key=Content-Type,value=text/plain.
Sample request:action: BatchSetDcdnDomainConfigs params: { "domainNames": "example.aliyundoc.com", "functions": [ { "functionArgs": [ { "ArgValue": "Cache-Control", "ArgName": "key" }, { "ArgValue": "no-cache", "ArgName": "value" } ], "functionName": "set_resp_header" }, { "functionArgs": [ { "ArgValue": "Content-Type", "ArgName": "key" }, { "ArgValue": "text/plain", "ArgName": "value" } ], "functionName": "set_resp_header" } ] } product: dcdn
If the operation succeeds, two configuration IDs are returned.{ "code":"200", "data":{ "DomainConfigList":{ "DomainConfigModel":[ { "FunctionName":"set_req_header", "DomainName":"example.aliyundoc.com", "ConfigId":20953663204**** }, { "FunctionName":"set_req_header", "DomainName":"example.aliyundoc.com", "ConfigId":20953663204**** } ] }, "RequestId":"69A79ACE-FD8E-5993-9CEA-7AAB2F085363" }, "httpStatusCode":"200", "requestId":"69A79ACE-FD8E-5993-9CEA-7AAB2F085363", "successResponse":true }
- Rule 1: Enable DCDN nodes to inform clients that the content returned to the clients
does not need to be cached.
Query configuration IDs
Call the DescribeDcdnDomainConfigs operation. If the operation succeeds, a configuration ID is returned.
example.aliyundoc.com
. Sample request:action: DescribeDcdnDomainConfigs
params: {
"domainName": "example.aliyundoc.com",
"functionNames": "set_req_header"
}
product: dcdn
{
"code": "200",
"data": {
"RequestId": "51B7DF03-A7AE-56ED-BF1E-D16F6A6B****",
"DomainConfigs": {
"DomainConfig": [{
"Status": "configuring",
"FunctionName": "set_req_header",
"FunctionArgs": {
"FunctionArg": [{
"ArgValue": "no-cache",
"ArgName": "value"
},
{
"ArgValue": "Cache-Control",
"ArgName": "key"
}
]
},
"ConfigId": 19572306654 ** **
}]
}
},
"httpStatusCode": "200",
"requestId": "51B7DF03-A7AE-56ED-BF1E-D16F6A6B****",
"successResponse": true
}
Use a configuration ID to update settings
Call the BatchSetDcdnDomainConfigs to update settings based on a specified configuration ID.
Scenario: The domain name example.com
is used as an example. Enable clients to cache content retrieved from DCDN nodes
for one hour.
example.com
: key=Cache-Control,value=max-age=3600. Sample request:action: BatchSetDcdnDomainConfigs
params: {
"Functions": [
{
"functionArgs": [
{
"argName": "value",
"argValue": "max-age=3600"
},
{
"argName": "key",
"argValue": "Cache-Control"
}
],
"functionName": "set_req_header",
"ConfigId": 19571990834****
}
],
"domainNames": "example.com"
}
product: dcdn
Use a configuration ID to delete settings
Call the DeleteDcdnSpecificConfig operation to delete settings based on a specified configuration ID.
example.aliyundoc.com
. Sample request:action: DeleteDcdnSpecificConfig
params: {
"ConfigId": 19571990834****,
"functionName": "set_req_header",
"domainName": "example.aliyundoc.com"
}
product: dcdn