文档首页/ 内容分发网络 CDN/ API参考/ API/ 模板配置/ 查询域名模板列表 - ShowDomainTemplate
更新时间:2026-11-06 GMT+08:00
分享

查询域名模板列表 - ShowDomainTemplate

功能介绍

查询域名模板列表。

调用方法

请参见如何调用API。

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
  • 如果使用身份策略授权,需具备如下身份策略权限。

    授权项

    访问级别

    资源类型(*为必须)

    条件键

    别名

    依赖的授权项

    cdn:configuration:queryDomains

    Read

    domain *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    -

    -

URI

GET /v1.0/cdn/configuration/templates

表1 Query参数

参数

是否必选

参数类型

描述

tml_name

否

String

参数解释:

域名模板名称

约束限制:

不涉及

取值范围:

  • 1-100个字符

  • 仅支持字母、数字、中文、下划线(_)、中横线(-)

默认取值:

不涉及

tml_id

否

String

参数解释:

域名模板ID,可以通过本接口获取

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

tml_type

否

Integer

参数解释:

域名模板类型

约束限制:

不涉及

取值范围:

  • 1: 系统预置模板

  • 2: 租户自定义模板

默认取值:

不涉及

limit

否

String

参数解释:

分页大小

约束限制:

不涉及

取值范围:

1-10000

默认取值:

30

offset

否

String

参数解释:

查询的页码

约束限制:

不涉及

取值范围:

0-65535

默认取值:

0

请求参数

无

响应参数

状态码:200

表2 响应Body参数

参数

参数类型

描述

total

Integer

参数解释:

查询域名模板总数

取值范围:

不涉及

templates

Array of TemplateItem objects

参数解释:

查询模板配置

表3 TemplateItem

参数

参数类型

描述

account_id

String

参数解释:

账户ID

取值范围:

不涉及

tml_name

String

参数解释:

域名模板名称

取值范围:

  • 1-100个字符

  • 仅支持字母、数字、中文、下划线(_)、中横线(-)

remark

String

参数解释:

域名模板描述

取值范围:

不涉及

tml_id

String

参数解释:

域名模板ID

取值范围:

不涉及

type

Integer

参数解释:

域名模板类型

取值范围:

  • 1: 系统预置模板

  • 2: 租户自定义模板

create_time

Integer

参数解释:

创建时间,Unix时间戳,单位为秒

取值范围:

不涉及

modify_time

Integer

参数解释:

修改时间,Unix时间戳,单位为秒

取值范围:

不涉及

configs

TemplateConfigs object

参数解释:

域名模板配置

表4 TemplateConfigs

参数

参数类型

描述

http_response_header

Array of HttpResponseHeader objects

参数解释:

HTTP响应头,CDN节点响应客户端时,根据HTTP响应头配置操作响应的HTTP头部信息

cache_rules

Array of CacheRules objects

参数解释:

设置源站资源在CDN节点的缓存时长

origin_follow302_status

String

参数解释:

开启回源跟随,当源站地址因业务需求做了301/302 重定向,CDN节点会先跳转到301/302对应地址获取资源,缓存后再返回给用户

取值范围:

  • on: 开启

  • off: 关闭

compress

Compress object

参数解释:

智能压缩,压缩网站的静态资源,缩小传输文件的大小,提升传输效率,减少带宽消耗

origin_range_status

String

参数解释:

Range回源,开启后,源站在收到CDN节点回源请求时,根据HTTP请求头中的Range信息返回指定范围的数据给CDN节点

取值范围:

  • on: 开启

  • off: 关闭

ip_filter

IpFilter object

参数解释:

IP黑白名单,对用户的请求IP地址进行过滤,从而限制访问来源

referer

RefererConfig object

参数解释:

referer黑白名单,对访问者身份进行识别和过滤,从而限制访问来源

user_agent_filter

UserAgentFilter object

参数解释:

UA黑白名单,对用户请求使用的代理过滤,从而限制访问来源

flow_limit_strategy

Array of FlowLimitStrategy objects

参数解释:

设置用量封顶阈值,当实际用量大于阈值时停用域名,有效预防流量盗刷或恶意攻击带来的高额账单。

说明:
由于监控数据存在时延,域名将在用量达到阈值后的10分钟左右被停用

origin_request_header

Array of OriginRequestHeader objects

参数解释:

回源请求头,CDN节点回源时,在请求源站时添加指定的HTTP请求头信息

https

UpdateDomainMultiCertificatesRequestBodyContent object

参数解释:

HTTPS证书配置,配置证书后,允许客户端采用HTTPS协议访问CDN节点

http2

String

参数解释:

HTTP/2开关,支持客户端采用HTTP/2协议访问CDN节点

取值范围:

  • on: 开启

  • off: 关闭

ocsp_stapling

String

参数解释:

OCSP Stapling开关,开启后CDN节点将获取并缓存服务器证书的OCSP响应结果并直接发送给客户端

取值范围:

  • on: 开启

  • off: 关闭

quic

Quic object

参数解释:

QUIC协议,客户端使用QUIC协议访问CDN节点,提高了传输的安全性,减少传输和连接时的延时,避免网络拥塞

force_redirect

ForceRedirect object

参数解释:

强制客户端使用HTTPS协议访问CDN节点

https_tls_version

HttpsTlsVersion object

参数解释:

配置TLS版本及加密套件,TLS版本需要匹配合适的加密套件使用,详情可参考CDN《用户指南》文档的“TLS版本与加密套件”章节。

access_area_filter

Array of AccessAreaFilter objects

参数解释:

区域访问控制,通过配置访问控制规则限制客户端所在地区,实现只允许或只禁止特定地区的用户访问资源

url_auth

UrlAuth object

参数解释:

配置URL鉴权功能,通过计算出的鉴权URL访问用户站点资源,防止资源被用户恶意下载盗用

rules

Array of RuleResponse objects

参数解释:

规则引擎,通过配置规则来对请求和响应进行自定义控制

表5 CacheRules

参数

参数类型

描述

match_type

String

参数解释:

匹配类型

取值范围:

  • all: 匹配所有文件

  • file_extension: 按文件后缀匹配

  • catalog: 按目录匹配

  • full_path: 全路径匹配

  • home_page: 按首页匹配

match_value

String

参数解释:

缓存规则匹配内容

取值范围:

不涉及

ttl

Integer

参数解释:

资源在CDN节点的缓存过期时间,单位由ttl_unit参数指定

取值范围:

不涉及

ttl_unit

String

参数解释:

缓存过期时间单位

取值范围:

  • s: 秒

  • m: 分

  • h: 小时

  • d: 天

priority

Integer

参数解释:

缓存规则的优先级,数值越大,优先级越高

取值范围:

1-1000

follow_origin

String

参数解释:

缓存过期时间来源,设置CDN节点的缓存遵循源站还是CDN侧的配置

取值范围:

  • on: CDN节点的缓存过期时间遵循源站的设置

  • off: CDN节点的缓存过期时间遵循“缓存规则”中的“缓存过期时间”

  • min_ttl: CDN节点的缓存过期时间取缓存规则和源站二者的最小值

force_cache

String

参数解释:

强制缓存:CDN节点缓存过期时间是否忽略源站响应头Cache-Control中的no-cache、private、no-store字段

取值范围:

  • on: 打开强制缓存

  • off: 关闭强制缓存

url_parameter_type

String

参数解释:

URL参数

取值范围:

  • del_params: 忽略指定URL参数

  • reserve_params: 保留指定URL参数

  • ignore_url_params: 忽略全部URL参数

  • full_url: 使用完整URL参数

url_parameter_value

String

参数解释:

URL参数值

取值范围:

不涉及

stale_while_revalidate

String

参数解释:

缓存回源后,从源站获取的新缓存数据在后台生效;在过期缓存生效期间,若客户端请求的资源大于新缓存更新时间,则CDN节点会响应过期内容,同时回源更新缓存

取值范围:

  • on: 开启

  • off: 关闭

表6 Compress

参数

参数类型

描述

status

String

参数解释:

智能压缩开关

取值范围:

  • on: 开启

  • off: 关闭

type

String

参数解释:

智能压缩类型

取值范围:

多种智能压缩类型用“,”分隔,可选值如下:

  • gzip: gzip压缩

  • br: brotli压缩

file_type

String

参数解释:

需要压缩的文件类型

取值范围:

  • 内容总长度不可超过2000个字符

  • 单个格式不可超过50个字符

  • 多种格式用“,”分隔

compress_min_length

Integer

参数解释:

压缩区间最小范围

取值范围:

  • 文件大小范围(0MB~30MB),单位为Byte

compress_max_length

Integer

参数解释:

压缩区间最大范围

取值范围:

  • 文件大小范围(0MB~30MB),单位为Byte

表7 IpFilter

参数

参数类型

描述

type

String

参数解释:

IP黑白名单类型

取值范围:

  • off: 关闭IP黑白名单

  • black: IP黑名单

  • white: IP白名单

value

String

参数解释:

配置IP黑白名单

说明:
支持IPv6,支持配置IP地址和IP&掩码格式的网段

取值范围:

不涉及

表8 RefererConfig

参数

参数类型

描述

type

String

参数解释:

Referer黑白名单类型

取值范围:

  • off: 关闭Referer黑白名单

  • black: Referer黑名单

  • white: Referer白名单

value

String

参数解释:

域名或IP地址

说明:
域名、IP地址可以混合输入,支持泛域名和带端口的域名

取值范围:

不涉及

include_empty

Boolean

参数解释:

是否包含空Referer

说明:
如果是黑名单并开启该选项,则表示无referer不允许访问

如果是白名单并开启该选项,则表示无referer允许访问

取值范围:

  • true: 包含空

  • false: 不包含空

表9 UserAgentFilter

参数

参数类型

描述

type

String

参数解释:

UA黑白名单类型

取值范围:

  • off: 关闭UA黑白名单

  • black: UA黑名单

  • white: UA白名单

value

String

参数解释:

UA黑白名单内容

说明:
此参数作为旧参数,将于近期下线,建议使用ua_list字段设置UA黑白名单内容

取值范围:

  • 单条规则不超过200个字符

  • 支持数字0-9、字符a-z、A-Z,空格,及特殊符"*"、"."、"-"、"_"、"("、")"、";"、","、"/"、"'"、"#"、"!"、"@"、"$"、"^"、"&"、"+"、"="、"~"、"?"、"""、"["、"]"、"{"、"}"、""、":"、"%"

include_empty

Boolean

参数解释:

是否包含空UA

说明:
如果黑名单并开启该选项,则表示无UA不允许访问

如果是白名单并开启该选项,则表示无UA允许访问

取值范围:

true: 包含空

false:不包含空

ua_list

Array of strings

参数解释:

配置UA黑白名单,每个数组元素为一条UA规则

表10 FlowLimitStrategy

参数

参数类型

描述

strategy_type

String

参数解释:

用量统计类型

取值范围:

  • instant: 瞬时用量

  • hour: 累计用量(小时)

  • day: 累计用量(天)

item_type

String

参数解释:

用量封顶类型

取值范围:

  • bandwidth: 带宽封顶,单位: bit/s

  • traffic: 流量封顶,单位: byte

limit_value

Long

参数解释:

用量封顶阈值,域名用量达到该阈值后,将会停用域名,单位由item_type参数决定(bandwidth对应bit/s,traffic对应byte)

取值范围:

必须为正整数

alarm_percent_threshold

Integer

参数解释:

用量告警阈值,单位为百分比(%),域名用量达到该百分比阈值后,将会发送告警

取值范围:

10-90

ban_time

Long

参数解释:

域名封禁周期

取值范围:

  • 0: 不自动解封

  • 60: 60分钟,即1个小时

  • 720: 720分钟,即12个小时

  • 1440: 1440分钟,即24个小时

  • 4320: 4320分钟,即3天

表11 UpdateDomainMultiCertificatesRequestBodyContent

参数

参数类型

描述

domain_name

String

参数解释:

需要配置HTTPS证书的域名

取值范围:

不涉及

https_switch

Integer

参数解释:

证书配置开关

取值范围:

  • 0: 关闭

  • 1: 开启

access_origin_way

Integer

参数解释:

回源协议

取值范围:

  • 1: 协议跟随

  • 2: http协议

  • 3: https协议

force_redirect_https

Integer

参数解释:

是否开启HTTPS强制跳转,强制客户端使用HTTPS协议访问CDN节点

说明:
此参数即将下线,建议使用force_redirect_config修改配置

取值范围:

  • 0: 关闭

  • 1: 开启

force_redirect_config

ForceRedirect object

参数解释:

强制客户端使用HTTPS协议访问CDN节点

http2

Integer

参数解释:

HTTP/2开关,支持客户端采用HTTP/2协议访问CDN节点

取值范围:

  • 0: 关闭

  • 1: 开启

cert_name

String

参数解释:

证书名称

取值范围:

3-64个字符,由英文字母、数字及“-”、“_”、空格组成

certificate

String

参数解释:

SSL证书内容

取值范围:

证书链长度不超过20KB

private_key

String

参数解释:

SSL证书私钥内容

取值范围:

不涉及

certificate_type

Integer

参数解释:

证书类型

取值范围:

  • 0: 自有证书

  • 2: SCM证书

scm_certificate_id

String

参数解释:

SCM证书ID,可使用云证书与管理服务(CCM)的查询证书列表接口获取

取值范围:

不涉及

certificates

Array of MultiCertificateBatchVo objects

参数解释:

配置国际证书和国密证书双证书场景下的证书列表

取值范围:

不涉及

表12 MultiCertificateBatchVo

参数

参数类型

描述

cert_name

String

参数解释:

证书名称

取值范围:

  • 3-64个字符

  • 由英文字母、数字及“-”、“_”、空格组成

certificate_category

Integer

参数解释:

证书类型

取值范围:

  • 0: 国际证书

  • 1: 国密证书

certificate_type

Integer

参数解释:

证书类型

取值范围:

  • 0: 自有证书

  • 1: 云托管证书

  • 2: SCM证书

certificate

String

参数解释:

SSL证书内容

取值范围:

证书链长度不超过20KB

private_key

String

参数解释:

SSL证书私钥内容

取值范围:

不涉及

enc_certificate

String

参数解释:

国密证书加密证书内容(国密证书使用双证书场景下必传)

取值范围:

不涉及

enc_private_key

String

参数解释:

国密证书加密私钥内容(国密证书使用双证书场景下必传)

取值范围:

不涉及

scm_certificate_id

String

参数解释:

SCM证书ID,配置SCM证书时必传

取值范围:

不涉及

表13 Quic

参数

参数类型

描述

status

String

参数解释:

QUIC功能状态开关

取值范围:

  • on: 开启

  • off: 关闭

表14 ForceRedirect

参数

参数类型

描述

switch

Integer

参数解释:

是否开启强制跳转,强制客户端使用HTTPS或HTTP协议访问CDN节点

取值范围:

  • 1: 开启

  • 0: 关闭

redirect_type

String

参数解释:

强制跳转类型

取值范围:

  • http: 强制跳转HTTP

  • https: 强制跳转HTTPS

表15 HttpsTlsVersion

参数

参数类型

描述

tls_version

String

参数解释:

传输层安全性协议,即TLS版本配置

取值范围:

目前支持TLSv1.0/1.1/1.2/1.3四个版本的协议

cipher_suite_group

String

参数解释:

加密算法套件组

取值范围:

  • default: 默认加密套件

  • general: 一般加密套件

  • strict: 强加密套件

  • custom: 自定义加密套件

cipher_suite

String

参数解释:

加密套件

取值范围:

  • ECDHE-ECDSA-AES128-GCM-SHA256

  • ECDHE-ECDSA-AES256-GCM-SHA384

  • ECDHE-RSA-AES128-GCM-SHA256

  • ECDHE-RSA-AES256-GCM-SHA384

  • DHE-RSA-AES128-GCM-SHA256

  • DHE-RSA-AES256-GCM-SHA384

  • ECDHE-ECDSA-AES128-SHA256

  • ECDHE-ECDSA-AES256-SHA384

  • ECDHE-RSA-AES128-SHA

  • ECDHE-RSA-AES128-SHA256

  • ECDHE-RSA-AES256-SHA

  • ECDHE-RSA-AES256-SHA384

  • DHE-RSA-AES128-SHA

  • DHE-RSA-AES128-SHA256

  • DHE-RSA-AES256-SHA

  • DHE-RSA-AES256-SHA256

  • AES128-GCM-SHA256

  • AES256-GCM-SHA384

  • AES128-SHA256

  • AES256-SHA256

  • ECDHE-ECDSA-CHACHA20-POLY1305

  • ECDHE-RSA-CHACHA20-POLY1305

  • DHE-RSA-CHACHA20-POLY1305

  • ECDHE-ECDSA-AES128-SHA

  • ECDHE-ECDSA-AES256-SHA

  • AES128-SHA

  • AES256-SHA

  • DES-CBC3-SHA

  • RC4-SHA

表16 AccessAreaFilter

参数

参数类型

描述

type

String

参数解释:

规则类型

取值范围:

  • black: 黑名单,如果匹配到黑名单规则,则黑名单所选区域内的用户将无法访问当前资源,返回403状态码

  • white: 白名单,白名单所选区域以外的用户均无法访问当前资源,返回403状态码

content_type

String

参数解释:

生效类型

取值范围:

  • all: 所有文件,所有文件均遵循配置的规则

  • file_directory: 目录路径,指定目录路径的资源遵循配置的规则

  • file_path: 全路径,指定路径的资源遵循配置的规则

content_value

String

参数解释:

生效规则

取值范围:

不涉及

area

String

参数解释:

配置规则适用的区域

取值范围:

不涉及

exception_ip

String

参数解释:

例外IP,配置指定IP不执行当前规则

取值范围:

不涉及

表17 UrlAuth

参数

参数类型

描述

status

String

参数解释:

是否开启URL鉴权

取值范围:

  • on: 开启

  • off: 关闭

type

String

参数解释:

鉴权方式

取值范围:

  • type_a: 鉴权方式A

  • type_b: 鉴权方式B

  • type_c1: 鉴权方式C1

  • type_c2: 鉴权方式C2

expire_time

Integer

参数解释:

鉴权URL的有效时间

取值范围:

0-31536000,单位:秒

sign_method

String

参数解释:

加密算法

取值范围:

  • md5

  • sha256

match_type

String

参数解释:

鉴权范围,指定哪些文件参与鉴权

取值范围:

  • all: 所有文件

  • include_file_extension: 指定后缀文件参与鉴权

  • exclude_file_extension: 指定后缀文件不参与鉴权

match_rule

String

参数解释:

鉴权文件匹配规则

取值范围:

  • 当match_type为all时,置空

  • 当match_type为include_file_extension或exclude_file_extension时,输入文件后缀,后缀以“.”为首字符,多个后缀以“,”分隔,如.jpg,.zip,.exe

inherit_config

InheritConfig object

参数解释:

鉴权继承,为M3U8/MPD索引文件下的TS/MP4文件添加鉴权参数,解决因鉴权不通过导致的TS/MP4文件无法播放的问题

key

String

参数解释:

鉴权密钥

取值范围:

  • 6-32个字符

  • 由大小写字母、数字构成

backup_key

String

参数解释:

备选鉴权密钥,当需要替换密钥时,如果需要新旧密钥同时生效,可设置备KEY。主、备KEY之一鉴权通过即可正常访问

取值范围:

  • 6-32个字符

  • 由大小写字母、数字构成

sign_arg

String

参数解释:

用户url中携带的鉴权信息参数名

取值范围:

  • 1-100个字符

  • 由大小写字母、数字、下划线构成(不能以数字开头)

time_format

String

参数解释:

时间格式

取值范围:

  • dec: 十进制

  • hex: 十六进制

time_arg

String

参数解释:

时间参数名称

取值范围:

  • 1-100个字符

  • 以字母开头,支持数字、字母和下划线,不允许出现其他特殊符号

表18 InheritConfig

参数

参数类型

描述

status

String

参数解释:

是否开启鉴权继承

取值范围:

  • on: 开启

  • off: 关闭

inherit_type

String

参数解释:

为m3u8/mpd索引文件下的ts/mp4文件添加鉴权参数,解决因鉴权不通过导致的ts/mp4文件无法播放的问题

取值范围:

  • m3u8

  • mpd

inherit_time_type

String

参数解释:

鉴权继承开始时间

取值范围:

  • sys_time: 当前系统时间

  • parent_url_time: 与m3u8和mpd访问链接保持一致

表19 RuleResponse

参数

参数类型

描述

rule_id

String

参数解释:

规则id

取值范围:

不涉及

name

String

参数解释:

规则名称

取值范围:

不涉及

status

String

规则状态,on:开启,off:关闭。

priority

Integer

参数解释:

此条规则的优先级,数值越大,优先级越高。

取值范围:

1-1000

conditions

Conditions object

参数解释:

触发当前规则的条件

actions

Array of Actions objects

满足规则条件后执行的动作列表

表20 Conditions

参数

参数类型

描述

match

Match object

参数解释:

规则匹配条件

表21 Match

参数

参数类型

描述

logic

String

参数解释:

逻辑运算符

取值范围:

  • and: 与关系

  • or: 或关系

criteria

Array of Criteria objects

参数解释:

匹配条件列表,可包含多个匹配参数,当用户请求匹配了当前设置的条件规则时,将执行当前规则配置的操作。

表22 Criteria

参数

参数类型

描述

match_target_type

String

参数解释:

匹配目标类型

取值范围:

  • scheme: 客户端请求使用的协议类型

  • method: 客户端请求IP使用的请求方法

  • path: 客户端请求URL路径

  • arg: 客户端请求URL中的查询参数

  • extension: 客户端请求IP内容的文件后缀

  • filename: 客户端请求IP内容的文件名称

  • header: HTTP请求头部

  • clientip: 客户端请求IP的客户端IP

  • clientip_version: 客户端请求IP的客户端IP版本

  • ua: 客户端请求IP头中的User-Agent

  • ngx_variable: Nginx变量

match_target_name

String

参数解释:

匹配目标名称

取值范围:

  • 当匹配目标类型为scheme、method、path、extension、filename、ua时,该值为空

  • 当匹配目标类型为arg时表示查询参数名,长度1-100,由数字,大小写字母,中划线和下划线组成,只能以字母开头

  • 当匹配目标类型为header时表示请求头的名称,长度1-100,由数字,大小写字母,中划线和下划线组成,只能以字母开头

  • 当匹配目标类型为clientip时表示ip来源,取值:connect:建联IP;xff:x-forwarded-for头

  • 当匹配目标类型为clientip_version时表示ip版本来源,取值:connect:建联IP;xff:x-forwarded-for头

  • 当匹配目标类型为ngx_variable时表示Nginx变量名,仅支持$protocol、$arg_、$http_、$scheme、$uri、$ssl_protocol、$ssl_server_name、$remote_addr、$http2、$request_method、$sent_http_

match_type

String

参数解释:

匹配算法

取值范围:

contains:包含匹配,匹配到match_pattern任意一个条件即匹配成功

match_pattern

Array of strings

参数解释:

匹配内容,为字符串数组,具体取值取决于匹配目标类型:

  • 当匹配目标类型为scheme时,取值:HTTP,HTTPS

  • 当匹配目标类型为method时,取值:GET,PUT,POST,DELETE,HEAD,OPTIONS,PATCH,TRACE,CONNECT

  • 当匹配目标类型为clientip_version时,取值:IPv4,IPv6

  • 当匹配目标类型为path和ua时,支持配置通配符“*”

negate

Boolean

参数解释:

是否取反,与match_type配合使用。例:negate配置为true,match_type配置为contains,则实际业务逻辑将转换为not_contains

取值范围:

  • true: 取反

  • false: 不取反

case_sensitive

Boolean

参数解释:

是否区分大小写

取值范围:

  • true: 区分大小写

  • false: 不区分大小写

logic

String

参数解释:

嵌套条件逻辑运算符

取值范围:

  • and: 与关系

  • or: 或关系

criteria

Array of Criteria objects

参数解释:

匹配条件列表,可包含多个匹配参数,当用户请求匹配了当前设置的条件规则时,将执行当前规则配置的操作。

表23 Actions

参数

参数类型

描述

flexible_origin

Array of flexibleOriginsEngine objects

参数解释:

高级回源,实现根据不同的资源类型或路径回源到不同源站

origin_request_header

Array of OriginRequestHeader objects

参数解释:

CDN节点回源时,改写用户回源请求URL的HTTP头部信息

http_response_header

Array of HttpResponseHeader objects

参数解释:

配置节点响应给客户端的头部信息,配置响应消息后,用户请求加速域名下的资源时,CDN返回给用户的消息中将包含该域名配置的响应头信息

access_control

AccessControl object

参数解释:

访问控制

request_limit_rule

RequestLimitRulesEngine object

参数解释:

请求限速,将用户请求速度限制在指定范围内,一定程度上减少突发高带宽风险,节省成本

origin_request_url_rewrite

OriginRequestUrlRewriteEngine object

参数解释:

改写回源URL

cache_rule

CacheRulesEngine object

参数解释:

通过不同参数控制源站资源在CDN节点的缓存时长

request_url_rewrite

RequestUrlRewriteEngine object

参数解释:

访问URL重写,当用户请求URL与CDN节点缓存资源的URL不一致时,可以通过访问URL重写功能重定向到目标URL

browser_cache_rule

BrowserCacheRulesEngine object

参数解释:

浏览器缓存过期时间,当终端用户请求资源时,如果浏览器有缓存,直接返回给用户

error_code_cache

Array of ErrorCodeCacheEngine objects

参数解释:

将源站返回的错误状态码缓存到CDN节点,用户再次请求时由CDN直接响应给用户错误状态码

表24 flexibleOriginsEngine

参数

参数类型

描述

sources_type

String

参数解释:

源站类型

取值范围:

  • ipaddr: 源站IP

  • domain: 源站域名

  • obs_bucket: OBS桶域名

  • third_bucket: 第三方桶域名

ip_or_domain

String

参数解释:

源站IP或者域名

取值范围:

不涉及

obs_bucket_type

String

参数解释:

OBS桶类型

取值范围:

  • private: 私有桶

  • public: 公有桶

bucket_access_key

String

参数解释:

第三方对象存储访问密钥

取值范围:

不涉及

bucket_secret_key

String

参数解释:

第三方对象存储密钥

取值范围:

不涉及

bucket_region

String

参数解释:

第三方对象存储区域

取值范围:

不涉及

bucket_name

String

参数解释:

第三方对象存储名称

取值范围:

不涉及

host_name

String

参数解释:

回源HOST

取值范围:

不涉及

origin_protocol

String

参数解释:

指定CDN回源时的请求协议

取值范围:

  • follow: 协议跟随

  • http: http协议

  • https: https协议

http_port

Integer

参数解释:

HTTP端口

取值范围:

1-65535

https_port

Integer

参数解释:

HTTPS端口

取值范围:

1-65535

priority

Integer

参数解释:

优先级,值越大优先级越高

取值范围:

1-100

weight

Integer

参数解释:

权重,值越大回源到该源站的次数越多。多个优先级相同的源站,由权重决定回源到各个源站的比例

取值范围:

1-100

表25 OriginRequestHeader

参数

参数类型

描述

name

String

参数解释:

设置回源请求头参数

取值范围:

  • 1-100个字符

  • 由数字,大小写字母,中划线组成

  • 只能以字母开头

value

String

参数解释:

设置回源请求头参数的值

取值范围:

  • 1-1000个字符

  • 由数字0 - 9、字符a - z、A - Z,及特殊符“.”、“-”、“_”、“*”、“#”、“!”、“&”、“+”、“|”、“^”、“~”、“'”、“"”、“/”、“:”、“;”、“,”、“=”、“@”、“?”、“<”、“>”组成

  • 当为删除动作时,可不填

  • 不支持中文

  • 不支持变量配置,如:$client_ip,$remote_port等

action

String

参数解释:

回源请求头设置类型

取值范围:

  • delete: 删除

  • set: 设置

表26 HttpResponseHeader

参数

参数类型

描述

name

String

参数解释:

设置HTTP响应头参数

取值范围:

  • 1-100个字符

  • 由数字,大小写字母,中划线组成,只能以字母开头

value

String

参数解释:

设置HTTP响应头参数的值

取值范围:

  • 1-1000个字符

  • 支持字母、数字和特定字符.-_*#!&+|^~'"/:;,=@?<>等

  • 当为删除动作时,可不填

action

String

参数解释:

设置HTTP响应头操作类型

取值范围:

  • set: 设置

  • delete: 删除

表27 AccessControl

参数

参数类型

描述

type

String

参数解释:

访问控制类型

取值范围:

  • block: 拒绝

  • trust: 允许

表28 RequestLimitRulesEngine

参数

参数类型

描述

limit_rate_after

Long

参数解释:

限速条件

说明:
例如:type=size,limit_rate_after=50表示从传输50个字节后开始限速且限速值为limit_rate_value

取值范围:

0-1073741824,单位:byte

limit_rate_value

Integer

参数解释:

限速值,即达到限速条件后的最大访问速度

取值范围:

0-104857600,单位:Bps

表29 OriginRequestUrlRewriteEngine

参数

参数类型

描述

rewrite_type

String

参数解释:

改写方式

取值范围:

  • simple: 精确改写

  • wildcard: 捕获改写

  • regex: 正则改写(白名单功能,请提交工单开放该配置)

source_url

String

参数解释:

需要替换的URI

取值范围:

  • 1-512个字符

  • 支持通配符*匹配,如:/test/*/*.mp4

  • 以正斜线(/)开头的URI,不含http(s)://头及域名

target_url

String

参数解释:

替换后的URI

取值范围:

  • 1-256个字符

  • 以正斜线(/)开头的URI,不含http(s)://头及域名

说明:
通配符 * 可通过$n捕获(n=1,2,3...,例如:/newtest/$1/$2.jpg)
表30 CacheRulesEngine

参数

参数类型

描述

ttl

Integer

参数解释:

资源在CDN节点的缓存过期时间

取值范围:

不涉及

ttl_unit

String

参数解释:

缓存过期时间单位

取值范围:

  • s: 秒

  • m: 分

  • h: 小时

  • d: 天

follow_origin

String

参数解释:

缓存过期时间来源,设置CDN节点的缓存遵循源站还是CDN侧的配置

取值范围:

  • on: CDN节点的缓存过期时间遵循源站的设置

  • off: CDN节点的缓存过期时间遵循“缓存规则”中的“缓存过期时间”

  • min_ttl: CDN节点的缓存过期时间取缓存规则和源站二者的最小值

force_cache

String

参数解释:

强制缓存:CDN节点缓存过期时间是否忽略源站响应头Cache-Control中的no-cache、private、no-store字段

取值范围:

  • on: 打开强制缓存

  • off: 关闭强制缓存

表31 RequestUrlRewriteEngine

参数

参数类型

描述

rewrite_type

String

参数解释:

改写方式

取值范围:

  • simple: 精确改写

  • wildcard: 捕获改写

  • regex: 正则改写

source_url

String

参数解释:

需要替换的URI

取值范围:

  • 1-512个字符

  • 支持通配符*匹配,如:/test/*/*.mp4

  • 以正斜线(/)开头的URI,不含http(s)://头及域名

redirect_status_code

Integer

参数解释:

重定向状态码

取值范围:

  • 301: 资源被永久转移。

  • 302: 由于不可预见的原因该页面暂不可用。

  • 303: 用于PUT或POST请求完成之后进行页面跳转,防止由于页面刷新导致的操作的重复触发。

  • 307: 由于不可预见的原因该页面暂不可用。

redirect_url

String

参数解释:

重定向URL

取值范围:

不涉及

redirect_host

String

参数解释:

支持将客户端请求重定向到其他域名

取值范围:

  • 1-255个字符

  • 必须以http://或https://开头

execution_mode

String

参数解释:

执行规则

取值范围:

  • redirect: 如果请求的URL匹配了当前规则,该请求将被重定向到目标Path。执行完当前规则后,当存在其他配置规则时,会继续匹配剩余规则

  • break: 如果请求的URL匹配了当前规则,请求将被改写为目标Path。执行完当前规则后,当存在其他配置规则时,将不再匹配剩余规则,此时不支持配置重定向Host和重定向状态码,返回状态码200

inherit_param

String

参数解释:

重定向URL是否携带请求参数

取值范围:

  • on: 携带

  • off: 不携带

表32 BrowserCacheRulesEngine

参数

参数类型

描述

cache_type

String

参数解释:

缓存生效类型

取值范围:

  • follow_origin: 遵循源站的缓存策略,即Cache-Control头部的设置

  • ttl: 浏览器缓存遵循当前规则设置的过期时间

  • never: 浏览器不缓存资源

ttl

Integer

参数解释:

缓存过期时间

取值范围:

不涉及

ttl_unit

String

参数解释:

缓存过期时间单位

取值范围:

  • s:秒

  • m:分钟

  • h:小时

  • d:天

表33 ErrorCodeCacheEngine

参数

参数类型

描述

code

Integer

参数解释:

需要缓存的错误码

取值范围:

  • 3xx: 301, 302

  • 4xx: 400, 401, 403, 404, 405, 407, 414, 416, 424, 451

  • 5xx: 500, 501, 502, 503, 504, 509, 514

ttl

Integer

参数解释:

错误码缓存时间

取值范围:

0-31536000,单位:秒

说明:
3XX状态码缓存时间范围为0-20s

状态码:400

表34 响应Body参数

参数

参数类型

描述

error

ErrMsg object

用于返回具体的错误码和错误消息

表35 ErrMsg

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

请求示例

GET https://cdn.myhuaweicloud.com/v1.0/cdn/configuration/templates?limit=1000&offset=0

响应示例

状态码:200

{
  "total" : 1,
  "templates" : [ {
    "type" : 2,
    "configs" : {
      "http_response_header" : [ {
        "action" : "set",
        "name" : "Content-Disposition",
        "value" : "example"
      } ]
    },
    "tml_name" : "example",
    "tml_id" : "example********************tmlid",
    "remark" : "this is remark",
    "account_id" : "example****************accountid",
    "create_time" : 1700000000000,
    "modify_time" : 1700000000000
  } ]
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.GlobalCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.cdn.v2.region.CdnRegion;
import com.huaweicloud.sdk.cdn.v2.*;
import com.huaweicloud.sdk.cdn.v2.model.*;


public class ShowDomainTemplateSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new GlobalCredentials()
                .withAk(ak)
                .withSk(sk);

        CdnClient client = CdnClient.newBuilder()
                .withCredential(auth)
                .withRegion(CdnRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowDomainTemplateRequest request = new ShowDomainTemplateRequest();
        try {
            ShowDomainTemplateResponse response = client.showDomainTemplate(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import GlobalCredentials
from huaweicloudsdkcdn.v2.region.cdn_region import CdnRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcdn.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = GlobalCredentials(ak, sk)

    client = CdnClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CdnRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowDomainTemplateRequest()
        response = client.show_domain_template(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
    cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth, err := global.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := cdn.CdnClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := cdn.NewCdnClient(hcClient)

    request := &model.ShowDomainTemplateRequest{}
	response, err := client.ShowDomainTemplate(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

成功响应

400

异常响应

错误码

请参见错误码。

相关文档