Each time you configure a feature for a domain name using BatchSetCdnDomainConfig or SetCdnDomainStagingConfig, Alibaba Cloud CDN generates a unique configuration ID (ConfigId) for that rule. Use the ConfigId to update or delete a specific rule without affecting other rules of the same type.
The typical workflow is: generate a ConfigId when you configure a rule, query it if needed, then use it to update or delete that rule.
API quick reference
| Operation | API |
|---|---|
| Generate a configuration ID | BatchSetCdnDomainConfig or SetCdnDomainStagingConfig |
| Query configuration IDs | DescribeCdnDomainConfigs or DescribeCdnDomainStagingConfig |
| Update settings using a ConfigId | BatchSetCdnDomainConfig or SetCdnDomainStagingConfig |
| Delete settings using a ConfigId | DeleteSpecificConfig or DeleteSpecificStagingConfig |
Generate a configuration ID
Call BatchSetCdnDomainConfig or SetCdnDomainStagingConfig to configure a feature for a domain name. A ConfigId is generated for each rule on success.
BatchSetCdnDomainConfig: returns the ConfigId directly in the response.
SetCdnDomainStagingConfig: does not return a ConfigId in the response. Call DescribeCdnDomainStagingConfig separately to retrieve it.
If a feature supports multiple rules, adding several rules in a single call returns one ConfigId per rule.
Example: Add a single response header rule
Set Cache-Control: no-cache on example.com to instruct points of presence (POPs) not to cache the content returned to clients.
action: BatchSetCdnDomainConfig
params: {
"Functions": [{
"functionArgs": [
{
"argName": "value",
"argValue": "no-cache"
},
{
"argName": "key",
"argValue": "Cache-Control"
}
],
"functionName": "set_resp_header"
}],
"domainNames": "example.com"
}
product: cdnOn success, one ConfigId is returned:
{
"code": "200",
"data": {
"DomainConfigList": {
"DomainConfigModel": [
{
"FunctionName": "set_resp_header",
"DomainName": "example.com",
"ConfigId": 19571990834****
}
]
},
"RequestId": "4FF61A1D-E697-5E6C-9E5D-7D1E1529****"
},
"httpStatusCode": "200",
"requestId": "4FF61A1D-E697-5E6C-9E5D-7D1E1529****",
"successResponse": true
}Example: Add multiple response header rules at once
Add two set_resp_header rules for example.aliyundoc.com: one sets Cache-Control: no-cache, and the other sets Content-Type: text/plain.
action: BatchSetCdnDomainConfig
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: cdnOn success, two ConfigIds are returned — one for each rule:
{
"code": "200",
"data": {
"DomainConfigList": {
"DomainConfigModel": [
{
"FunctionName": "set_resp_header",
"DomainName": "example.aliyundoc.com",
"ConfigId": 20953663204****
},
{
"FunctionName": "set_resp_header",
"DomainName": "example.aliyundoc.com",
"ConfigId": 20953663204****
}
]
},
"RequestId": "69A79ACE-FD8E-5993-9CEA-7AAB2F08****"
},
"httpStatusCode": "200",
"requestId": "69A79ACE-FD8E-5993-9CEA-7AAB2F08****",
"successResponse": true
}Query configuration IDs
Call DescribeCdnDomainConfigs or DescribeCdnDomainStagingConfig to retrieve ConfigIds for existing rules.
Example: Query ConfigIds for a domain
Query the set_resp_header settings for example.aliyundoc.com:
action: DescribeCdnDomainConfigs
params: {
"domainName": "example.aliyundoc.com",
"functionNames": "set_resp_header"
}
product: cdnThe response includes the ConfigId for each matching rule:
{
"code": "200",
"data": {
"RequestId": "51B7DF03-A7AE-56ED-BF1E-D16F6A6B****",
"DomainConfigs": {
"DomainConfig": [{
"Status": "configuring",
"FunctionName": "set_resp_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
}Update settings using a configuration ID
Call BatchSetCdnDomainConfig or SetCdnDomainStagingConfig with a ConfigId to update a specific rule. Include the ConfigId in the function object to target that rule.
Example: Update Cache-Control to max-age=3600
Change the Cache-Control header on example.com from no-cache to max-age=3600 to instruct POPs to cache responses for one hour:
action: BatchSetCdnDomainConfig
params: {
"Functions": [
{
"functionArgs": [
{
"argName": "value",
"argValue": "max-age=3600"
},
{
"argName": "key",
"argValue": "Cache-Control"
}
],
"functionName": "set_resp_header",
"ConfigId": 19571990834****
}
],
"domainNames": "example.com"
}
product: cdnDelete settings using a configuration ID
Call DeleteSpecificConfig or DeleteSpecificStagingConfig with a ConfigId to delete a specific rule.
Example: Delete a response header rule
Delete the set_req_header rule with ConfigId 19571990834**** on example.aliyundoc.com:
action: DeleteSpecificConfig
params: {
"ConfigId": 19571990834****,
"functionName": "set_resp_header",
"domainName": "example.aliyundoc.com"
}
product: cdn