You need to enable JavaScript to run this app.
文档中心
内容分发网络

内容分发网络

复制全文
下载 pdf
UpdateCdnConfig - 修改加速域名配置
访问控制
复制全文
下载 pdf
访问控制

使用限制

节流限制:您每秒最多可以提交 20 个 API 请求。

请求说明

  • 请求方式:POST
  • 请求地址:https://cdn.volcengineapi.com/?Action=UpdateCdnConfig&Version=2021-03-01

公共参数

参数名称
数据类型
是否必选
参数说明
Action
String
接口名称。当前 API 的名称为 UpdateCdnConfig
Version
String
接口版本。当前 API 的版本为 2021-03-01

请求正文参数

域名配置

参数名称
数据类型
是否必选
参数说明
示例
Domain
String
表示要修改配置的加速域名。
www.example.com

URL 标准化

参数名称
数据类型
是否必选
参数说明
示例
UrlNormalize
Object
表示 "URL 标准化" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "UrlNormalize": {
        "Switch": true,
        "NormalizeObject": [
            "dot_segments",
            "back_slashes",
            "successive_slashes"
        ]
    }
}

地域访问控制

参数名称
数据类型
是否必选
参数说明
示例
AreaAccessRule
Object
表示 "地域访问控制" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "AreaAccessRule": {
        "Switch": true,
        "RuleType": "allow",
        "Area": [
            "CHE",
            "AZE"
        ]
    }
}

禁用 HTTP Method

参数名称
数据类型
是否必选
参数说明
示例
MethodDeniedRule
Object
表示 "禁用 HTTP Method" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "MethodDeniedRule": {
        "Switch": true,
        "Methods": "delete,get"
    }
}

IP 黑白名单

参数名称
数据类型
是否必选
参数说明
示例
IpAccessRule
Object

表示 "IP 黑白名单" 特性的配置。

该特性提供了两种配置方式:

  • 常规配置:指定 RuleTypeIp 对当前加速域名进行配置。
  • 全局配置:指定 SharedConfig 使用一个全局配置。全局配置是白名单功能。要使用此功能,请 提交工单
您只能选择一种配置方式。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "IpAccessRule": {
        "Switch": true,
        "DenyStatusCode": 402,
        "RuleType": "allow",
        "Ip": [
            "xxx.xxx.xx.xx",
            "xxx.xxx.xx.xxx"
        ],
        "IpSource": {
        	"SourceList": ["x-forwarded-for","x-real-ip"],
        	"Type": "custom"
        }
    }
}

Referer 黑白名单

参数名称
数据类型
是否必选
参数说明
示例
RefererAccessRule
Object
表示 "Referer 黑白名单" 特性的配置。关于不同配置对请求匹配结果的影响,参见 配置示例

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "RefererAccessRule": {
        "AllowEmpty": true,
        "ReferersType": {
            "CommonType": {
                "IgnoreCase": true,
                "IgnoreScheme": true,
                "Referers": [
                    "xxx.x.x.x"
                ]
            },
            "RegularType": {
                "Referers": [
                    "^http\\://a\\.com"
                ]
            }
        },
        "RuleType": "deny",
        "Switch": true
    }
}

UA 黑白名单

参数名称
数据类型
是否必选
参数说明
示例
UaAccessRule
Object
表示 "UA 黑白名单" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "UaAccessRule": {
        "AllowEmpty": true,
        "RuleType": "deny",
        "Switch": true,
        "UserAgent": [
            "*curl*",
            "*firefox*"
        ]
    }
}

Origin 黑白名单

参数名称
数据类型
是否必选
参数说明
示例
OriginAccessRule
Object
表示 "Origin 黑白名单" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "OriginAccessRule": {
        "Switch": true,
        "RuleType": "allow",
        "Origins": [
            "test.abc.com"
        ],
        "AllowEmpty": true
    }
}

自定义头部黑白名单

参数名称
数据类型
是否必选
参数说明
示例
CustomizeAccessRule
Object
表示 "自定义头部黑白名单" 特性的配置。要使用该特性,请 提交工单

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "domain": "www.example.com",
    "CustomizeAccessRule": {
        "CustomizeInstances": [
            {
                "CustomizeRule": {
                    "AccessAction": {
                        "AllowEmpty": false,
                        "ListRules": [
                            "^abc$"
                        ],
                        "RequestHeader": "header1",
                        "RuleType": "deny"
                    }
                }
            },
            {
                "CustomizeRule": {
                    "AccessAction": {
                        "AllowEmpty": true,
                        "ListRules": [
                            "[abc].{2,3}3f",
                            "foo[1-9]{1,2}bc"
                        ],
                        "RequestHeader": "header2",
                        "RuleType": "allow"
                    }
                }
            }
        ],
        "Switch": true
    }
}

自定义拦截规则

参数名称
数据类型
是否必选
参数说明
示例
RequestBlockRule
Object
表示 "自定义拦截" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "RequestBlockRule": {
        "BlockRule": [
            {
                "BlockAction": {
                    "Action": "refuse",
                    "StatusCode": "403"
                },
                "Condition": {
                    "ConditionRule": [
                        {
                            "Object": "path",
                            "Operator": "equal",
                            "Type": "url",
                            "Value": "/img/*.jpg;/doc/output"
                        },
                        {
                            "Object": "directory",
                            "Operator": "equal",
                            "Type": "url",
                            "Value": "/food/;/finance/global/"
                        },
                        {
                            "Object": "filetype",
                            "Operator": "not_equal",
                            "Type": "url",
                            "Value": "png;jpg"
                        }
                    ],
                    "Connective": "OR"
                },
                "RuleName": "url-demo-rule"
            },
            {
                "BlockAction": {
                    "Action": "refuse",
                    "ErrorPage": "xddtest-volc1",
                    "StatusCode": "406"
                },
                "Condition": {
                    "ConditionRule": [
                        {
                            "Name": "qn1",
                            "Object": "query_name",
                            "Operator": "equal",
                            "Type": "querystring",
                            "Value": "val1"
                        },
                        {
                            "Name": "qn2",
                            "Object": "query_name",
                            "Operator": "belong_shared_config",
                            "Type": "querystring",
                            "Value": "rstest0101"
                        },
                        {
                            "Name": "qn3",
                            "Object": "query_name",
                            "Operator": "empty",
                            "Type": "querystring"
                        },
                        {
                            "Name": "qn4",
                            "Object": "query_name",
                            "Operator": "exist",
                            "Type": "querystring"
                        }
                    ],
                    "Connective": "OR"
                },
                "RuleName": "req-query_demo_rule"
            },
            {
                "BlockAction": {
                    "Action": "redirect",
                    "RedirectUrl": "https://error.example.com",
                    "StatusCode": "301"
                },
                "Condition": {
                    "ConditionRule": [
                        {
                            "Object": "regex",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "a.c;^/colou?r$"
                        },
                        {
                            "Object": "full_querystring",
                            "Operator": "not_match",
                            "Type": "querystring",
                            "Value": "co{1,3}r=chapter[1-5]"
                        },
                        {
                            "Object": "client_ip",
                            "Operator": "match",
                            "Type": "client_ip",
                            "Value": "x.x.x.x;xx.xx.xx.xx/24"
                        },
                        {
                            "Name": "",
                            "Object": "ua",
                            "Operator": "match",
                            "Type": "request_header",
                            "Value": "*firefox*|ua"
                        },
                        {
                            "Name": "custom-header",
                            "Object": "customize",
                            "Operator": "match",
                            "Type": "request_header",
                            "Value": "val1|val2|val3|val4"
                        }
                    ],
                    "Connective": "OR"
                },
                "RuleName": "others-demo-rule"
            }
        ],
        "Switch": true
    }
}

URL 重定向改写

参数名称
数据类型
是否必选
参数说明
示例
RedirectionRewrite
Object
表示 "URL 重定向改写" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "RedirectionRewrite": {
        "Switch": true,
        "RedirectionRule": [
            {
                "RedirectionAction": {
                    "SourcePath": "/img/volcano.png",
                    "RedirectCode": "301",
                    "TargetHost": "www.test.com",
                    "TargetProtocol": "followclient",
                    "TargetPath": "/png/volcano.png",
                    "TargetQueryComponents": {
                        "Action": "include",
                        "Value": ""
                    }
                }
            }
        ]
    }
}

URL 鉴权

参数名称
数据类型
是否必选
参数说明
示例
SignedUrlAuth
Object
表示 "URL 鉴权" 特性的配置。

请求示例

Typed 鉴权类型的示例(包含 M3U8 改写功能的配置)。

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "SignedUrlAuth": {
        "SignedUrlAuthRules": [
            {
                "Condition": {
                    "ConditionRule": [
                        {
                            "Object": "filetype",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "jpg;jpeg"
                        }
                    ],
                    "Connective": "OR"
                },
                "SignedUrlAuthAction": {
                    "AuthAlgorithm": "md5",
                    "BackupSecretKey": "xxxx",
                    "Duration": 1800,
                    "KeepOriginArg": true,
                    "MasterSecretKey": "xxxxxxxxx",
                    "RewriteM3u8": true,
                    "RewriteM3u8Rule": {
                        "DeleteParam": false,
                        "KeepM3u8Param": false,
                        "RewriteTag": {
                            "Switch": true,
                            "Tags": [
                                "EXT-X-MAP",
                                "MY-TAG"
                            ]
                        }
                    },
                    "SignName": "sign",
                    "TimeFormat": "decimal",
                    "TimeName": "t",
                    "URLAuthType": "typed"
                }
            }
        ],
        "Switch": true
    }
}

Type-E 请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "SignedUrlAuth": {
        "SignedUrlAuthRules": [
            {
                "Condition": {
                    "ConditionRule": [
                        {
                            "Name": "",
                            "Object": "filetype",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "jpg;jpeg"
                        },
                        {
                            "Object": "directory",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "/dir1/;/dir2/"
                        },
                        {
                            "Object": "path",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "/index.shtml;/index.html"
                        },
                        {
                            "Object": "regex",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "^/[a-zA-Z0-9_\\-/]*$"
                        }
                    ],
                    "Connective": "OR"
                },
                "SignedUrlAuthAction": {
                    "AuthAlgorithm": "md5",
                    "BackupSecretKey": "xxxxxxx",
                    "CustomVariableRules": {
                        "CustomVariableInstances": [
                            {
                                "Operator": "match",
                                "Type": "queryString",
                                "Value": "my-param"
                            },
                            {
                                "Operator": "match",
                                "Type": "requestHeader",
                                "Value": "my-header"
                            }
                        ]
                    },
                    "DeleteAuthCacheAndOrigin": true,
                    "Duration": 1800,
                    "MasterSecretKey": "xxxxxxxxxxx",
                    "RewriteM3u8": true,
                    "RewriteM3u8Rule": {
                        "DeleteParam": true,
                        "KeepM3u8Param": true,
                        "RewriteTag": {
                            "Switch": true,
                            "Tags": [
                                "EXT-X-MAP",
                                "MY-TAG"
                            ]
                        }
                    },
                    "SignName": "sign",
                    "SignatureRule": [
                        "key",
                        "domain",
                        "uri",
                        "TimeName",
                        "my-param",
                        "ip",
                        "my-header"
                    ],
                    "TimeFormat": "decimal",
                    "TimeName": "t",
                    "URLAuthType": "typee"
                }
            }
        ],
        "Switch": true
    }
}

远程鉴权

参数名称
数据类型
是否必选
参数说明
示例
RemoteAuth
Object
表示 "远程鉴权" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "RemoteAuth": {
        "RemoteAuthRules": [
            {
                "Condition": {
                    "ConditionRule": [
                        {
                            "Name": "",
                            "Object": "filetype",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "jpg;png"
                        },
                        {
                            "Name": "",
                            "Object": "directory",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "/test/dir1/;/test/dir2/"
                        },
                        {
                            "Name": "",
                            "Object": "path",
                            "Operator": "match",
                            "Type": "url",
                            "Value": "/index.php"
                        }
                    ],
                    "Connective": "OR"
                },
                "RemoteAuthRuleAction": {
                    "AuthModeConfig": {
                        "BackupRemoteAddr": "http://auth1.example.com:8080",
                        "MasterRemoteAddr": "http://auth2.example.com:8080",
                        "PathType": "variable",
                        "PathValue": "/auth",
                        "RequestMethod": "default"
                    },
                    "AuthResponseConfig": {
                        "CacheAction": {
                            "Action": "cache",
                            "CacheKey": [
                                "URI",
                                "content_type"
                            ],
                            "IgnoreCase": false,
                            "Ttl": 10
                        },
                        "ResponseAction": {
                            "StatusCode": "403"
                        },
                        "StatusCodeAction": {
                            "DefaultAction": "pass",
                            "FailCode": "401",
                            "SuccessCode": "200"
                        },
                        "TimeOutAction": {
                            "Action": "pass",
                            "Time": 200
                        }
                    },
                    "QueryStringRules": {
                        "QueryStringComponents": {
                            "Action": "includePart",
                            "Value": "color;size"
                        },
                        "QueryStringInstances": [
                            {
                                "Action": "set",
                                "Key": "param1",
                                "Value": "val1",
                                "ValueType": "constant"
                            },
                            {
                                "Action": "set",
                                "Key": "param2",
                                "Value": "referer",
                                "ValueType": "variable"
                            },
                            {
                                "Action": "set",
                                "Key": "param3",
                                "Value": "val3${referer}!",
                                "ValueType": "customize"
                            }
                        ]
                    },
                    "RequestBodyRules": "default",
                    "RequestHeaderRules": {
                        "RequestHeaderComponents": {
                            "Action": "includePart",
                            "Value": "header1;header2"
                        },
                        "RequestHeaderInstances": [
                            {
                                "Action": "set",
                                "Key": "hd1",
                                "Value": "val1",
                                "ValueType": "constant"
                            },
                            {
                                "Action": "set",
                                "Key": "hd2",
                                "Value": "content_type",
                                "ValueType": "variable"
                            },
                            {
                                "Action": "set",
                                "Key": "hd3",
                                "Value": "val3${client_ip}a${URI}",
                                "ValueType": "customize"
                            }
                        ],
                        "RequestHost": "test.example.com"
                    }
                }
            }
        ],
        "Switch": true
    }
}

下载限速

参数名称
数据类型
是否必选
参数说明
示例
DownloadSpeedLimit
Object
表示 "下载限速" 特性的配置。

请求示例

POST https://cdn.volcengineapi.com/?Version=2021-03-01&Action=UpdateCdnConfig
{
    "Domain": "www.example.com",
    "DownloadSpeedLimit": {
        "Switch": true,
        "DownloadSpeedLimitRules": [
            {
                "Condition": {
                    "ConditionRule": [
                        {
                            "Type": "url",
                            "Object": "filetype",
                            "Operator": "match",
                            "Value": "png;js"
                        }
                    ]
                },
                "DownloadSpeedLimitAction": {
                    "DynamicLimitUnit": "KB/S",
                    "LimitQueryName": "my_query",
                    "LimitType": "dynamic_limit",
                    "SpeedLimitRate": 102400,
                    "SpeedLimitRateAfter": 1024,
                    "SpeedLimitTime": {
                        "DayWeek": "monday",
                        "BeginTime": "18:00",
                        "EndTime": "23:00"
                    }
                }
            }
        ]
    }
}

返回参数

由于该 API 没有响应参数,响应正文只有包含请求元数据的 ResponseMetadata 结构体,没有 Result 结构体。

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2022010415564801021219713102003D3F",
        "Action": "UpdateCdnConfig",
        "Version": "2021-03-01",
        "Service": "CDN",
        "Region": "cn-north-1"
    }
}

错误码

如果响应正文的 ResponseMetadata 字段中包含 Error 字段,则表示 API 请求失败。更多关于错误码的信息,参见错误码

最近更新时间:2026.07.29 14:06:57
这个页面对您有帮助吗?
有用
有用
无用
无用