When you call the BatchSetDcdnDomainConfigs operation to configure features for a domain name, a unique configuration ID (ConfigId) is generated. You can use this ConfigId to update or delete the corresponding settings.
Usage notes on ConfigId
| Feature | Description |
| Generate a configuration ID | Call the BatchSetDcdnDomainConfigs operation. A configuration ID is generated upon success. |
| Query configuration IDs | Call the DescribeDcdnDomainConfigs operation to retrieve the configuration IDs of a domain name. |
| 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. A configuration ID is returned upon success.
Scenario: Use the domain name
example.comto instruct DCDN nodes to add a response header that tells clients not to cache the returned content.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: dcdnIf 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 } -
Configure multiple feature rules: Some features support more than one rule. The following example adds two rules at a time:
Example: Set the set_resp_header parameter for the domain nameexample.aliyundoc.comand add the following two rules:- Rule 1: Instruct DCDN nodes to tell clients not to cache the returned content.
Parameter settings: key=Cache-Control,value=no-cache.
- Rule 2: Instruct DCDN nodes to tell clients that the returned content is plain text.
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: dcdnIf 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: Instruct DCDN nodes to tell clients not to cache the returned content.
Query configuration IDs
Call the DescribeDcdnDomainConfigs operation to retrieve the configuration IDs of a domain name.
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 operation to update settings by specifying a configuration ID.
Scenario: Use the domain name example.com to instruct 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: dcdnUse 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