All Products
Search
Document Center

Edge Security Acceleration:Usage notes on ConfigId

Last Updated:Apr 18, 2024

After you call the BatchSetDcdnDomainConfigs 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

Feature

Description

Generate a configuration ID

Call the BatchSetDcdnDomainConfigs operation. If the operation succeeds, a configuration ID is generated.

Query a configuration ID

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 generated and returned.

    Scenario: The accelerated domain name example.com is used as an example. Enable Dynamic Content Delivery Network (DCDN) points of presence (POPs) to inform clients that the returned content does not need to be cached.

    For example, set the set_resp_header feature for the domain name example.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_resp_header"
        }],
        "domainNames": "example.com"
    }
    product: dcdn

    If the operation succeeds, a configuration ID 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
    }
  • Some features support more than one rule. The following example shows how to add multiple rules at a time:

    Add the following two rules for set_resp_header for the domain name example.aliyundoc.com:

    • Rule 1: Enable DCDN POPs to inform clients that the returned content does not need to be cached.

      Parameter settings: key=Cache-Control, value=no-cache.

    • Rule 2: Enable DCDN POPs to inform clients that the returned content 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_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 a configuration ID

Call the DescribeDcdnDomainConfigs operation. If the operation succeeds, a configuration ID is returned.

Example: Query the settings of set_resp_header for the domain name example.aliyundoc.com. Sample request:

action: DescribeDcdnDomainConfigs
params: {
    "domainName": "example.aliyundoc.com",
    "functionNames": "set_resp_header"
}
product: dcdn

A configuration ID is returned.

{
    "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
}

Use a configuration ID to update settings

Call the BatchSetDcdnDomainConfigs to update settings based on a specified configuration ID.

Scenario: The accelerated domain name example.com is used as an example. Enable POPs to cache served content for one hour.

For example, set the set_resp_header feature for the domain name 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_resp_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.

For example, delete the specified settings of set_resp_header for the domain name example.aliyundoc.com. Sample request:

action: DeleteDcdnSpecificConfig
params: {
    "ConfigId": 19571990834****, 
    "functionName": "set_resp_header", 
    "domainName": "example.aliyundoc.com"
}
product: dcdn