After you call the BatchSetCdnDomainConfig or SetCdnDomainStagingConfig operation to configure a feature 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 BatchSetCdnDomainConfig or SetCdnDomainStagingConfig operation. If the operation succeeds, a configuration ID is generated. |
Query configuration IDs | Call the DescribeCdnDomainConfigs or DescribeCdnDomainStagingConfig operation. If the operation succeeds, a configuration ID is returned. |
Use a configuration ID to update settings | Call the BatchSetCdnDomainConfig or SetCdnDomainStagingConfig operation to update settings based on a specified configuration ID. |
Use a configuration ID to delete settings | Call the DeleteSpecificConfig or DeleteSpecificStagingConfig operation to delete settings based on a specified configuration ID. |
Generate a configuration ID
-
Configure a single feature rule:
- Call the BatchSetCdnDomainConfig operation to configure a specified feature for a domain name. If the operation succeeds, a configuration ID is returned.
- Call the SetCdnDomainStagingConfig operation to configure a specified feature for a domain name. However, no configuration ID is returned after the operation succeeds. You must call the DescribeCdnDomainStagingConfig operation to query the configuration ID.
Scenario: The domain name
example.com
is used as an example. Enable Alibaba Cloud CDN edge nodes to inform clients that the content returned to the clients do 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: BatchSetCdnDomainConfig params: { "Functions": [{ "functionArgs": [{ "argName": "value", "argValue": "no-cache" }, { "argName": "key", "argValue": "Cache-Control" } ], "functionName": "set_req_header" }], "domainNames": "example.com" } product: cdn
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 Alibaba Cloud CDN edge nodes to inform clients that the content returned
to the clients do not need to be cached.
Parameter settings: key=Cache-Control,value=no-cache.
- Rule 2: Enable Alibaba Cloud CDN edge 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: 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: cdn
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 Alibaba Cloud CDN edge nodes to inform clients that the content returned
to the clients do not need to be cached.
Query configuration IDs
Call the DescribeCdnDomainConfigs or DescribeCdnDomainStagingConfig operation. If the operation succeeds, a configuration ID is returned.
example.aliyundoc.com
. Sample request:action: DescribeCdnDomainConfigs
params: {
"domainName": "example.aliyundoc.com",
"functionNames": "set_req_header"
}
product: cdn
{
"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 BatchSetCdnDomainConfig or SetCdnDomainStagingConfig 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 Alibaba Cloud
CDN edge nodes for one hour.
example.com
: key=Cache-Control,value=max-age=3600. Sample request:action: BatchSetCdnDomainConfig
params: {
"Functions": [
{
"functionArgs": [
{
"argName": "value",
"argValue": "max-age=3600"
},
{
"argName": "key",
"argValue": "Cache-Control"
}
],
"functionName": "set_req_header",
"ConfigId": 19571990834****
}
],
"domainNames": "example.com"
}
product: cdn
Use a configuration ID to delete settings.
Call the DeleteSpecificConfig or DeleteSpecificStagingConfig operation to delete settings based on a specified configuration ID.
example.aliyundoc.com
. Sample request:action: DeleteSpecificConfig
params: {
"ConfigId": 19571990834****,
"functionName": "set_req_header",
"domainName": "example.aliyundoc.com"
}
product: cdn