更新时间:2024-05-08 GMT+08:00
分享

查询域名配置接口

功能介绍

查询域名配置接口, 支持查询业务类型、服务范围、备注、IPv6开关、回源方式、回源URL改写、高级回源、Range回源、回源跟随、回源是否校验Etag、回源超时时间、回源请求头、HTTPS配置、TLS版本配置、强制跳转、HSTS、HTTP/2、 OCSP Stapling、QUIC、缓存规则、状态码缓存时间、防盗链、IP黑白名单、 Use-Agent黑白名单、URL鉴权配置、远程鉴权配置、IP访问限频、 HTTP header配置、自定义错误页面配置、智能压缩、请求限速配置、WebSocket配置、视频拖拽、回源SNI、访问URL重写、浏览器缓存过期时间。

调用方法

请参见如何调用API

URI

GET /v1.1/cdn/configuration/domains/{domain_name}/configs

表1 路径参数

参数

是否必选

参数类型

描述

domain_name

String

加速域名。

表2 Query参数

参数

是否必选

参数类型

描述

enterprise_project_id

String

企业项目ID, all:所有项目。

show_special_configs

String

取值为auth_key,用来查询鉴权KEY和鉴权备KEY的值。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token, 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

configs

ConfigsGetBody object

配置项。

表5 ConfigsGetBody

参数

参数类型

描述

business_type

String

业务类型:

  • web:网站加速;
  • download:文件下载加速;
  • video:点播加速;
  • wholesite:全站加速。

service_area

String

服务区域:

  • mainland_china:中国大陆;
  • global:全球;
  • outside_mainland_china:中国大陆境外。

remark

String

域名备注。

origin_request_header

Array of OriginRequestHeader objects

回源请求头配置。

http_response_header

Array of HttpResponseHeader objects

http header配置。

url_auth

UrlAuthGetBody object

URL鉴权查询响应体。

https

HttpGetBody object

证书配置查询响应体。

sources

Array of SourcesConfig objects

源站配置。

origin_protocol

String

回源协议,follow:协议跟随回源,http:HTTP回源(默认),https:https回源。

origin_follow302_status

String

回源跟随,on:开启,off:关闭。

cache_rules

Array of CacheRules objects

缓存规则。

ip_filter

IpFilter object

IP黑白名单。

referer

RefererConfig object

防盗链。

force_redirect

ForceRedirectConfig object

强制跳转。

compress

Compress object

智能压缩。

cache_url_parameter_filter

CacheUrlParameterFilterGetBody object

缓存url参数配置查询响应体,

说明:

此参数作为旧参数,将于近期下线。

ipv6_accelerate

Integer

ipv6设置,1:打开;0:关闭。

error_code_cache

Array of ErrorCodeCache objects

状态码缓存时间。

origin_range_status

String

Range回源,开启: on,off:关闭。

user_agent_filter

UserAgentFilter object

UA黑白名单设置

origin_request_url_rewrite

Array of OriginRequestUrlRewrite objects

改写回源URL。

flexible_origin

Array of flexibleOrigins objects

高级回源。

slice_etag_status

String

回源是否校验ETag,on:开启,off:关闭。

origin_receive_timeout

Integer

回源超时时间,单位:秒。

remote_auth

commonRemoteAuth object

远程鉴权配置。

websocket

webSocketSeek object

webSocket配置。

说明:

只有全站加速的域名支持该配置。

video_seek

videoSeek object

视频拖拽配置。

说明:
  1. 需同步开启FLV、MP4格式文件的URL参数功能,并选择“忽略参数”。
  2. 关闭视频拖拽功能时,FLV时间拖拽功能失效。

request_limit_rules

Array of RequestLimitRules objects

请求限速配置。

ip_frequency_limit

IpFrequencyLimitQuery object

Ip访问限频。

hsts

HstsQuery object

HSTS:配置HSTS后,将强制客户端(如浏览器)使用 HTTPS 协议访问服务器,提升访问安全性。

quic

Quic object

QUIC协议。

error_code_redirect_rules

Array of ErrorCodeRedirectRules objects

自定义错误页面

sni

Sni object

回源SNI。

request_url_rewrite

Array of RequestUrlRewrite objects

访问URL重写。

browser_cache_rules

Array of BrowserCacheRules objects

浏览器缓存过期时间。

表6 OriginRequestHeader

参数

参数类型

描述

name

String

设置回源请求头参数。格式要求:长度1-64,由数字,大小写字母,中划线组成,只能以字母开头。

value

String

设置回源请求头参数的值。当为删除动作时,可不填。自定义回源请求头参数长度范围1-1000,不支持中文,不支持变量配置,如:$client_ip,$remote_port等。

action

String

回源请求头设置类型。delete:删除,set:设置。同一个请求头字段只允许删除或者设置。设置:若原始回源请求中不存在该字段,先执行新增再执行设置。

表7 HttpResponseHeader

参数

参数类型

描述

name

String

设置HTTP响应头参数。取值:"Content-Disposition", "Content-Language", "Access-Control-Allow-Origin","Access-Control-Allow-Methods", "Access-Control-Max-Age", "Access-Control-Expose-Headers"或自定义头部。格式要求:长度1-100,由数字,大小写字母,中划线组成,只能以字母开头。

value

String

设置HTTP响应头参数的值。当为删除动作时,可不填。自定义HTTP响应头参数长度范围1-1000,支持字母、数字和特定字符,如:.-_*#!&+|^~'"/:;,=@?<> 等。

action

String

设置http响应头操作类型,取值“set/delete”。set代表设置,delete代表删除。

表8 UrlAuthGetBody

参数

参数类型

描述

status

String

是否开启URL鉴权,on:开启,off:关闭。

type

String

鉴权方式, type_a:鉴权方式A, type_b:鉴权方式B, type_c1:鉴权方式C1, type_c2:鉴权方式C2。

expire_time

Integer

过期时间,单位:秒。

sign_method

String

加密算法。

match_type

String

鉴权范围。

inherit_config

InheritConfigQuery object

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

key

String

鉴权KEY。

backup_key

String

鉴权KEY(备)。

sign_arg

String

鉴权参数。

time_format

String

时间格式, dec:十进制, hex:十六进制。

表9 InheritConfigQuery

参数

参数类型

描述

status

String

是否开启鉴权继承,on:开启,off:关闭。

inherit_type

String

鉴权继承配置, m3u8:M3U8,mpd:MPD,“m3u8,mpd”。

inherit_time_type

String

鉴权继承的文件类型时间, sys_time:当前系统时间,parent_url_time:与m3u8和mpd访问链接保持一致。

表10 HttpGetBody

参数

参数类型

描述

https_status

String

HTTPS证书是否启用,on:开启,off:关闭。

certificate_type

String

证书类型。server:国际证书;server_sm:国密证书。

certificate_source

Integer

证书来源,1:华为云托管证书,0:自有证书。

certificate_name

String

证书名字。

certificate_value

String

HTTPS协议使用的证书内容,PEM编码格式。

expire_time

Long

证书过期时间。

说明:

UTC时间。

http2_status

String

是否使用HTTP2.0,on:是,off:否。

tls_version

String

传输层安全性协议。

ocsp_stapling_status

String

是否开启ocsp stapling,on:是,off:否。

表11 SourcesConfig

参数

参数类型

描述

origin_type

String

源站类型,

  • ipaddr:源站IP;
  • domain:源站域名;
  • obs_bucket:OBS桶域名;
  • third_bucket:第三方桶。

origin_addr

String

源站IP或者域名。

priority

Integer

源站优先级,70:主,30:备。

weight

Integer

权重,取值范围1-100。

obs_web_hosting_status

String

是否开启OBS静态网站托管,源站类型为obs_bucket时传递,off:关闭,on:开启。

http_port

Integer

HTTP端口,默认80,端口取值取值范围1-65535。

https_port

Integer

HTTPS端口,默认443,端口取值取值范围1-65535。

host_name

String

回源HOST,默认加速域名。

obs_bucket_type

String

OBS桶源站类型:

  • “private” 私有桶;
  • “public” 公有桶,默认为公有桶。

bucket_access_key

String

第三方对象存储访问密钥。

说明:

源站类型为第三方桶时必填

bucket_secret_key

String

第三方对象存储密钥。

说明:

源站类型为第三方桶时必填

bucket_region

String

第三方对象存储区域。

说明:

源站类型为第三方桶时必填

bucket_name

String

第三方对象存储名称。

说明:

源站类型为第三方桶时必填

表12 CacheRules

参数

参数类型

描述

match_type

String

匹配类型:

  • all:匹配所有文件,
  • file_extension:按文件后缀匹配,
  • catalog:按目录匹配,
  • full_path:全路径匹配,
  • home_page:按首页匹配。
    说明:

    配置单条缓存规则时,可不传,默认为all。 配置多条缓存规则时,此参数必传。

match_value

String

缓存匹配设置, 当match_type为all时,为空。当match_type为file_extension时,为文件后缀,输入首字符为“.”,以“,”进行分隔, 如.jpg,.zip,.exe,并且输入的文 件名后缀总数不超过20个。 当match_type为catalog时,为目录路径,输入要求以“/”作为首字符, 以“,”进行分隔,如/test/folder01,/test/folder02,并且输入的目录路径总数不超过20个。 当match_type为full_path时,为全路径,输入要求以“/”作为首字符,支持匹配指定目录下的具体文件,或者带通配符“*”的文件,单条全路径缓存规则里仅支持配置一个全路径,如/test/index.html或/test/*.jpg。 当match_type为home_page时,为空。

ttl

Integer

缓存过期时间,最大支持365天。

说明:

默认值为0。

ttl_unit

String

缓存过期时间单位,s:秒;m:分;h:小时;d:天。

priority

Integer

此条缓存规则的优先级, 默认值1,数值越大,优先级越高,取值范围为1-100,优先级不能相同。

follow_origin

String

缓存遵循源站开关,on:打开,off:关闭。 > 默认值为off。

url_parameter_type

String

URL参数:

  • del_params:忽略指定URL参数,
  • reserve_params:保留指定URL参数,
  • ignore_url_params:忽略全部URL参数,
  • full_url:使用完整URL参数。
    说明:

    不传此参数时,默认为full_url。

url_parameter_value

String

URL参数值,最多设置10条,以","分隔。 > 当url_parameter_type为del_params或reserve_params时必填。

表13 IpFilter

参数

参数类型

描述

type

String

IP黑白名单类型,off:关闭IP黑白名单,black:IP黑名单,white:IP白名单。

value

String

配置IP黑白名单,当type=off时,非必传, 支持IPv6,支持配置IP地址和IP&掩码格式的网段, 多条规则用“,”分割,最多支持配置500个, 多个完全重复的IP/IP段将合并为一个,不支持带通配符的地址,如192.168.0.*。

表14 RefererConfig

参数

参数类型

描述

type

String

Referer黑白名单类型,off:关闭Referer黑白名单,black:Referer黑名单,white:Referer白名单。

value

String

域名或IP地址,以“,”进行分割,域名、IP地址可以混合输入,支持泛域名和带端口的域名。域名、IP地址总数不超过400个,端口取值范围1-65535。

include_empty

Boolean

是否包含空Referer,如果是黑名单并开启该选项,则表示无referer不允许访问,如果是白名单并开启该选项,则表示无referer允许访问,true:包含空,false:不包含空,默认值false。

表15 ForceRedirectConfig

参数

参数类型

描述

status

String

强制跳转开关(on:打开, off:关闭)。

type

String

强制跳转类型(http:强制跳转HTTP,https:强制跳转HTTPS)。

redirect_code

Integer

重定向跳转码301,302。

表16 Compress

参数

参数类型

描述

status

String

智能压缩开关(on:开启 off:关闭)。

type

String

智能压缩类型(gzip:gzip压缩,br:brotli压缩)。

file_type

String

压缩格式,内容总长度不可超过200个字符, 多种格式用“,”分割,每组内容不可超过50个字符, 开启状态下,首次传空时默认值为.js,.html,.css,.xml,.json,.shtml,.htm,否则为上次设置的结果。

表17 CacheUrlParameterFilterGetBody

参数

参数类型

描述

type

String

缓存URL参数操作类型:

  • full_url:缓存所有参数;
  • ignore_url_params:忽略所有参数;
  • del_params:忽略指定URL参数;
  • reserve_params:保留指定URL参数。
    说明:

    本接口参数有调整,参数替换如下:

    • del_params替代del_args。
    • reserve_params替代reserve_args。

value

String

参数值。

表18 ErrorCodeCache

参数

参数类型

描述

code

Integer

允许配置的错误码: 400, 403, 404, 405, 414, 500, 501, 502, 503, 504

ttl

Integer

错误码缓存时间,单位为秒,范围0-31,536,000(一年默认为365天)。

表19 UserAgentFilter

参数

参数类型

描述

type

String

UA黑白名单类型 off:关闭UA黑白名单; black:UA黑名单; white:UA白名单;

value

String

配置UA黑白名单,当type=off时,非必传。最多配置10条规则,单条规则不超过100个字符,多条规则用“,”分割。

ua_list

Array of strings

配置UA黑白名单,当type=off时,非必传。最多配置10条规则,单条规则不超过100个字符, 同时配置value和ua_list时,ua_list生效。

表20 OriginRequestUrlRewrite

参数

参数类型

描述

priority

Integer

回源URL改写规则的优先级。 优先级设置具有唯一性,不支持多条回源URL改写规则设置同一优先级,且优先级不能输入为空。 多条规则下,不同规则中的相同资源内容,CDN按照优先级高的规则执行URL改写。 取值为1-100之间的整数,数值越大优先级越高。

match_type

String

匹配类型, all:所有文件, file_path:URI路径, wildcard:通配符。 full_path: 全路径

source_url

String

需要替换的URI。 改写后的URI以正斜线(/)开头的URI,不含http(s)://头及域名。 长度不超过512个字符。 支持通配符*匹配,如:/test/*/*.mp4。 匹配方式为“所有文件”时,不支持配置参数。

target_url

String

以正斜线(/)开头的URI,不含http(s)://头及域名。 长度不超过256个字符。 通配符 * 可通过$n捕获(n=1,2,3...,例如:/newtest/$1/$2.jpg)。

表21 flexibleOrigins

参数

参数类型

描述

match_type

String

URI的匹配方式,支持文件后缀(file_extension)和路径前缀(file_path)。

match_pattern

String

file_extension(文件后缀): 支持所有格式的文件类型。 输入首字符为“.”,以“;”进行分隔。 输入的文件后缀名总数不能超过20个。 file_path(目录路径):输入要求以“/”作为首字符,以“;”进行分隔,输入的目录路径总数不能超过20个。

priority

Integer

优先级取值范围为1-100,数值越大优先级越高。

back_sources

Array of backSources objects

回源信息。

说明:

每个目录的回源源站数量不超过1个。

表22 backSources

参数

参数类型

描述

sources_type

String

源站类型, ipaddr:源站IP,domain:源站域名,obs_bucket:OBS桶域名。

ip_or_domain

String

源站IP或者域名。

obs_bucket_type

String

OBS桶类型。

  • “private”: 私有桶;
  • “public”: 公有桶。

http_port

Integer

HTTP端口,取值范围:1-65535。

https_port

Integer

HTTPS端口,取值范围:1-65535。

表23 commonRemoteAuth

参数

参数类型

描述

remote_authentication

String

是否开启远程鉴权(on:开启,off:关闭)。

remote_auth_rules

RemoteAuthRule object

远程鉴权配置。

表24 RemoteAuthRule

参数

参数类型

描述

auth_server

String

可访问的鉴权服务器地址。 输入的URL必须有“http”或“https”。不能是localhost或127.0.0.1这类本地地址。 不能是CDN的加速域名。

request_method

String

鉴权服务器支持的请求方法,支持GET、POST、HEAD。

file_type_setting

String

all(所有文件类型):所有文件均参与鉴权。 specific_file(指定文件类型):指定类型的文件参与鉴权。示例:jpg|MP4。 文件类型不区分大小写,即:jpg和JPG代表同一种文件类型,多个文件类型用“|”分割。

specified_file_type

String

字符总数不能超过512,当file_type_setting等于specific_file时为必选,其余情况为空, 由大小写字母和数字构成,文件类型用竖线分隔,例如jpg|mp4,只有在必选情况下才会对该字段做校验。

reserve_args_setting

String

设置用户请求中需要参与鉴权的参数,可选reserve_all_args(保留所有URL参数)、reserve_specific_args(保留指定URL参数)、ignore_all_args(忽略所有URL参数)。

reserve_args

String

当reserve_args_setting等于reserve_specific_args时为必选,其余情况为空,要保留的参数,多个参数用竖线分隔:key1|key2。

add_custom_args_rules

Array of customArgs objects

URL鉴权参数。

reserve_headers_setting

String

设置用户请求中参与鉴权请求头,可选reserve_all_headers(保留所有请求头参数)、reserve_specific_headers(保留指定请求头参数)、ignore_all_headers(忽略所有请求头参数)。

add_custom_headers_rules

Array of customArgs objects

请求头鉴权参数。

auth_success_status

String

设置鉴权成功时远程鉴权服务器返回给CDN节点的状态码。取值范围:2xx/3xx。

auth_failed_status

String

设置鉴权失败时远程鉴权服务器返回给CDN节点的状态码。取值范围:4xx/5xx。

response_status

String

设置鉴权失败时CDN节点返回给用户的状态码。取值范围:2xx/3xx/4xx/5xx。

timeout

Integer

设置鉴权超时时间,即从CDN转发鉴权请求开始,到CDN节点收到远程鉴权服务器返回的结果的时间。单位为毫秒,值为0或50-3000。

timeout_action

String

设置鉴权超时后,CDN节点如何处理用户请求。 pass(鉴权失败放过):鉴权超时后允许用户请求,返回对应的资源。 forbid(鉴权失败拒绝):鉴权超时后拒绝用户请求,返回配置的响应自定义状态码给用户。

reserve_headers

String

当reserve_headers_setting等于reserve_specific_headers时为必选,其余情况为空,要保留的请求头,多个请求头用竖线分隔:key1|key2。

表25 customArgs

参数

参数类型

描述

type

String

参数类型,custom_var:自定义,nginx_preset_var:预置的变量。

key

String

参数,长度支持1-256,由数字0-9、字符a-z、A-Z,及特殊字符._-*#%|+^@?=组成。

value

String

当type为custom_var时长度支持1-256,由数字0-9、字符a-z、A-Z,及特殊字符._-*#%|+^@?=组成, 当type为nginx_preset_var时,value只能输入$http_host、$http_user_agent、$http_referer、$http_x_forwarded_for、 $http_content_type、$remote_addr、$scheme、$server_protocol、$request_uri、$uri、$args、$request_method。

表26 webSocketSeek

参数

参数类型

描述

status

String

开关, on 开启,off 关闭。

timeout

Integer

请求建立连接后,会话的保持时间:范围:1-300,单位:秒。

表27 videoSeek

参数

参数类型

描述

enable_video_seek

Boolean

视频拖拽开关, true:开启,false:关闭

说明:

当本字段设置为“false”时,查询域名配置接口将不会返回视频拖拽配置信息。

enable_flv_by_time_seek

Boolean

flv时间拖拽开关, true:开启,false:关闭。

start_parameter

String

自定义用户请求URL中视频播放的开始参数,支持使用数字0-9、字符a-z、A-Z,及"_",长度≤64个字符。

end_parameter

String

自定义用户请求URL中视频播放的结束参数,支持使用数字0-9、字符a-z、A-Z,及"_",长度≤64个字符。

表28 RequestLimitRules

参数

参数类型

描述

status

String

status只支持on,off无效。

说明:

request_limit_rules字段置空时代表关闭请求限速功能。 旧接口中的参数,后续将下线。

priority

Integer

优先级,值越大,优先级越高,取值范围:1-100。

match_type

String

匹配类型,all:所有文件,catalog:目录。

match_value

String

匹配类型值。 当match_type为all时传空值,例如:""; 当match_type为catalog时传目录地址,以“/”作为首字符,例如:"/test"。

说明:

值为catalog的时候必填

type

String

限速方式,当前仅支持按流量大小限速,取值为size。

limit_rate_after

Long

限速条件,type=size,limit_rate_after=50表示从传输表示传输50个字节后开始限速且限速值为limit_rate_value, 单位byte,取值范围:0-1073741824。

limit_rate_value

Integer

限速值,单位Bps,取值范围 0-104857600。

表29 IpFrequencyLimitQuery

参数

参数类型

描述

status

String

状态,on:打开,off:关闭。

qps

Integer

访问阈值,单位:次/秒。

表30 HstsQuery

参数

参数类型

描述

status

String

状态,on:打开,off:关闭。

max_age

Integer

过期时间,即:响应头“Strict-Transport-Security”在客户端的缓存时间。单位:秒。

include_subdomains

String

包含子域名,on:包含,off:不包含。

表31 Quic

参数

参数类型

描述

status

String

状态,on:打开,off:关闭。

表32 ErrorCodeRedirectRules

参数

参数类型

描述

error_code

Integer

重定向的错误码,当前支持以下状态码 4xx:400, 403, 404, 405, 414, 416, 451 5xx:500, 501, 502, 503, 504。

target_code

Integer

重定向状态码,取值为301或302。

target_link

String

重定向的目标链接

表33 Sni

参数

参数类型

描述

status

String

是否开启回源SNI,on:打开,off:关闭。

server_name

String

CDN节点回源需要访问的源站域名。如test.example.com。

说明:
  1. 开启回源SNI时必填。
  2. 不支持泛域名,仅支持输入数字、“-”、“.”、英文大小写字符。
表34 RequestUrlRewrite

参数

参数类型

描述

condition

UrlRewriteCondition object

匹配条件。

redirect_status_code

Integer

重定向状态码。支持301、302、303、307。

redirect_url

String

重定向URL。重定向后的URL,以正斜线(/)开头,不含http://头及域名,如:/test/index.html。

  • 当匹配类型为全路径时,"*"可以用“$1”捕获,例如:匹配内容为/test/*.jpg,重定向URL配置为/newtest/$1.jpg,则用户请求/test/11.jpg时,$1捕获11,重定向后请求的URL为/newtest/11.jpg。

redirect_host

String

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

说明:

不填时默认为当前域名。 支持字符长度为1-255,必须以http://或https://开头,例如http://www.example.com。

execution_mode

String

执行规则:

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

参数

参数类型

描述

match_type

String

匹配类型。

  • catalog:指定目录下的文件需执行访问URL重写规则,
  • full_path:某个完整路径下的文件需执行访问URL重写规则。

match_value

String

匹配内容。当match_type为catalog时,为目录路径,输入要求以“/”作为首字符,以“,”进行分隔,如/test/folder01,/test/folder02,并且输入的目录路径总数不超过20个。当match_type为full_path时,为全路径,输入要求以“/”作为首字符,支持匹配指定目录下的具体文件,或者带通配符“*”的文件,单条全路径缓存规则里仅支持配置一个全路径,如/test/index.html或/test/*.jpg。

priority

Integer

访问URL重写规则的优先级。取值为1-100之间的整数,数值越大优先级越高。优先级设置具有唯一性,不支持多条规则设置同一优先级,且优先级不能为空。

表36 BrowserCacheRules

参数

参数类型

描述

condition

BrowserCacheRulesCondition object

匹配条件。

cache_type

String

缓存生效类型:

  • follow_origin:遵循源站的缓存策略,即Cache-Control头部的设置,
  • ttl:浏览器缓存遵循当前规则设置的过期时间,
  • never:浏览器不缓存资源。

ttl

Integer

缓存过期时间,最大支持365天。

说明:

当缓存生效类型为ttl时必填。

ttl_unit

String

缓存过期时间单位,s:秒;m:分种;h:小时;d:天。

说明:

当缓存生效类型为ttl时必填。

表37 BrowserCacheRulesCondition

参数

参数类型

描述

match_type

String

匹配类型:

  • all:匹配所有文件,
  • file_extension:按文件后缀匹配,
  • catalog:按目录匹配,
  • full_path:全路径匹配,
  • home_page:按首页匹配。

match_value

String

缓存匹配设置,当match_type为all时,为空。当match_type为file_extension时,为文件后缀,输入首字符为“.”,以“,”进行分隔, 如.jpg,.zip,.exe,并且输入的文 件名后缀总数不超过20个。 当match_type为catalog时,为目录,输入要求以“/”作为首字符, 以“,”进行分隔,如/test/folder01,/test/folder02,并且输入的目录路径总数不超过20个。 当match_type为full_path时,为全路径,输入要求以“/”作为首字符,支持匹配指定目录下的具体文件,或者带通配符“*”的文件,单条全路径缓存规则里仅支持配置一个全路径,如/test/index.html或/test/*.jpg。 当match_type为home_page时,为空。

priority

Integer

浏览器缓存的优先级,取值为1-100之间的整数,数值越大优先级越高。优先级设置具有唯一性,不支持多条规则设置同一优先级,且优先级不能为空。

请求示例

GET https://cdn.myhuaweicloud.com/v1.1/cdn/configuration/domains/www.example.com/configs

响应示例

状态码: 200

成功响应。

{
  "configs" : {
    "origin_request_header" : [ ],
    "http_response_header" : [ ],
    "https" : {
      "https_status" : "off"
    },
    "url_auth" : {
      "status" : "off"
    },
    "compress" : {
      "status" : "off"
    },
    "force_redirect" : {
      "status" : "on",
      "type" : "http"
    },
    "origin_protocol" : "follow",
    "referer" : {
      "type" : "string",
      "value" : "string",
      "include_empty" : true
    },
    "ip_filter" : {
      "type" : "string",
      "value" : "string"
    },
    "origin_follow302_status" : "off",
    "cache_rules" : [ {
      "match_type" : "string",
      "match_value" : "string",
      "ttl" : 0,
      "ttl_unit" : "string",
      "priority" : 0,
      "follow_origin" : "string",
      "url_parameter_type" : "string",
      "url_parameter_value" : "string"
    } ],
    "sources" : [ {
      "origin_addr" : "www.example.com",
      "origin_type" : "domain",
      "priority" : 70,
      "http_port" : 80,
      "https_port" : 443
    } ],
    "cache_url_parameter_filter" : {
      "type" : "del_params",
      "value" : "key1;key2"
    },
    "flexible_origin" : [ {
      "priority" : 1,
      "match_type" : "/test",
      "match_pattern" : "file_path",
      "back_sources" : [ {
        "sources_type" : "domain",
        "ip_or_domain" : "www.example.com",
        "obs_bucket_type" : "public"
      } ]
    } ],
    "slice_etag_status" : "off",
    "ipv6_accelerate" : 1,
    "origin_receive_timeout" : 30,
    "remote_auth" : {
      "remote_authentication" : "on",
      "remote_auth_rules" : {
        "auth_server" : "https://1.1.1.1",
        "request_method" : "GET",
        "file_type_setting" : "all",
        "reserve_args_setting" : "reserve_all_args",
        "reserve_args" : "string",
        "specified_file_type" : "string",
        "reserve_headers_setting" : "reserve_specific_headers",
        "auth_success_status" : "200",
        "auth_failed_status" : "403",
        "response_status" : "403",
        "timeout" : 500,
        "timeout_action" : "pass",
        "reserve_headers" : "sf",
        "add_custom_args_rules" : [ {
          "type" : "nginx_preset_var",
          "key" : "http_host",
          "value" : "$http_host"
        } ],
        "add_custom_headers_rules" : [ {
          "type" : "nginx_preset_var",
          "key" : "http_host",
          "value" : "$http_host"
        } ]
      }
    },
    "websocket" : {
      "status" : "off",
      "timeout" : 60
    },
    "video_seek" : {
      "enable_video_seek" : true,
      "enable_flv_by_time_seek" : true,
      "start_parameter" : "start",
      "end_parameter" : "end"
    },
    "request_limit_rules" : [ {
      "status" : "on",
      "type" : "size",
      "limit_rate_after" : 1024,
      "limit_rate_value" : 50
    } ],
    "sni" : {
      "status" : "on",
      "server_name" : "test.example.com"
    },
    "request_url_rewrite" : [ {
      "condition" : {
        "match_type" : "full_path",
        "match_value" : "/test/*.jpg",
        "priority" : 10
      },
      "redirect_status_code" : 301,
      "redirect_url" : "/test/index.html",
      "execution_mode" : "redirect"
    } ],
    "browser_cache_rules" : [ {
      "condition" : {
        "match_type" : "full_path",
        "match_value" : "/test/*.jpg",
        "priority" : 10
      },
      "cache_type" : "ttl",
      "ttl" : 20,
      "ttl_unit" : "h"
    } ]
  }
}

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
46
47
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 ShowDomainFullConfigSolution {

    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();
        ShowDomainFullConfigRequest request = new ShowDomainFullConfigRequest();
        request.withEnterpriseProjectId("<enterprise_project_id>");
        request.withShowSpecialConfigs("<show_special_configs>");
        try {
            ShowDomainFullConfigResponse response = client.showDomainFullConfig(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
31
# coding: utf-8

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 = __import__('os').getenv("CLOUD_SDK_AK")
    sk = __import__('os').getenv("CLOUD_SDK_SK")

    credentials = GlobalCredentials(ak, sk) \

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

    try:
        request = ShowDomainFullConfigRequest()
        request.enterprise_project_id = "<enterprise_project_id>"
        request.show_special_configs = "<show_special_configs>"
        response = client.show_domain_full_config(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
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 := global.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := cdn.NewCdnClient(
        cdn.CdnClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowDomainFullConfigRequest{}
	enterpriseProjectIdRequest:= "<enterprise_project_id>"
	request.EnterpriseProjectId = &enterpriseProjectIdRequest
	showSpecialConfigsRequest:= "<show_special_configs>"
	request.ShowSpecialConfigs = &showSpecialConfigsRequest
	response, err := client.ShowDomainFullConfig(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

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

状态码

状态码

描述

200

成功响应。

错误码

请参见错误码

分享:

    相关文档

    相关产品