修改指定加速域名的配置。
| 参数名称 | 描述 |
|---|---|
*domainString | 需要修改的域名,可以是域名名称或域名id。 |
| 参数名称 | 描述 |
|---|---|
versionString | 版本号 |
service-areasString | 加速域名的加速区域,如果有需要根据区域限定资源覆盖时,才需要指定加速区域。未指定加速区域时,我们将按照客户开通的服务区域,以最优的资源覆盖提供加速服务。多个区域以分号分隔,支持配置的区域如下:cn(中国大陆)、am(美洲)、emea(欧洲、中东、非洲)、apac(亚太地区) |
cname-labelString | 共用一级标签,若有多个加速域名需要共用一级域名,则可以使用该参数。即拥有相同cname-label的一组域名,共用一级cname。
注意:
1、拥有相同cname-label的域名共用一级cname,且有完全一致的dns覆盖
2、共用一级的约束:加速类型一致(service-type)、证书id一致(certificate-id,如果有证书)、加速区域一致(service-areas)
3、多个http域名可共用一级,多个sni https域名可共用一级
4、单个域名使用cname-label时,域名可cancel;多个域名共用一级时,不允许cancel这些域名
5、支持通过修改cname-label达到修改cname的目的。 |
commentString | 备注信息,最大限制1000个字符 |
cache-hostString | 缓存文件HOST。缓存HOST域名和加速域名的缓存规则必须一致。 |
header-of-clientipString | 传递客户端ip的响应头部,可选值为Cdn-Src-Ip、X-Forwarded-For、ori_X-Forwarded-For
1) Cdn-Src-Ip: 回源头部名称为Cdn-Src-Ip,获取与节点进行建联的IP作为客户端IP传递回源。
2) X-Forwarded-For: 回源头部名称为X-Forwarded-For,携带的客户端IP值是Cdn-Src-Ip获取到的建联IP。
3) ori_X-Forwarded-For:客户端请求CDN节点时会自带X-Forwarded-For,则CDN透传此头部和值回源。 |
origin-configObject | 回源策略设置,用于设置加速域名的源站信息和回源策略 |
origin-ipsString | 回源地址,可以是IP或域名。
1、IP以分号分隔,支持多个。
2、域名只能输入一个。IP与域名不能同时输入。
3、限制最大不能超过500个字符长度。
4、IP最多15个。 |
adv-origin-configsObject | |
detect-urlString | 高级源监控url,通过该url请求 |
detect-periodString | 高级源监控周期,单位秒,可选值为大于等于0的整数,0表示不监控 |
adv-origin-configList | 高级源配置 |
master-ipsString | 高级源主要回源IP,多个IP用分号“;”分隔,回源IP不能重复 |
backup-ipsString | 高级源备用回源IP,多个IP用分号“;”分隔,回源IP不能重复 |
default-origin-host-headerString | 回源HOST,用于更改回源HTTP请求头中的HOST字段。支持格式为域名或ip。
注意:必须符合ip/域名格式规范。如果是域名,则域名每段(点号分隔)长度小于等于62,域名总长度小于等于128。 |
origin-portString | 回源请求端口。 |
live-configObject | 直播域名配置,用于设置直播加速域名的推拉流 |
origin-ipsString | 源站IP,当stream-type为pull时,源站IP和配套推流域名至少一个不为空。
1、如果是推拉流配套,则填写127.0.0.1,不传系统也默认为127.0.0.1
2、如果是直接回源拉流,则填写回源拉流的源站IP |
origin-push-hostString | 配套推流域名,用于设置直播拉流域名对应的推流域名,当stream-type为pull时,源站IP和配套推流域名至少一个不为空;当stream-type为push时,无需传入。 |
sslObject | ssl证书设置,用于设置加速域名的ssl证书配置。上传证书请使用接口:【新增证书V2】;若要修改证书,请使用接口:【修改证书V2】。 |
use-sslString | 使用证书,可选值为true和false,true表示使用证书,false表示不使用证书 |
use-for-sniString | 使用sni证书,可选值为true和false,true表示使用sni证书,false表示使用合用证书(暂不支持) |
ssl-certificate-idString | 证书ID,新增证书成功后,系统返回的证书ID
use-ssl为true时,才能传ssl-certificate-id。(点播和下载加速类型的证书需要下单给运维单独配置) |
cache-behaviorsList | 缓存规则设置,用于设置加速域名的缓存规则,请使用新接口:修改缓存时间配置接口 |
path-patternString | url匹配模式,支持正则,如果是全部匹配,入参可以配置为:*
如果要修改缓存规则,此项必填 |
priorityString | 表示一条配置的优先级,值越大优先级越高 |
cache-ttlString | 缓存时间:设置缓存对象对应的时间。入参格式:整数,不缓存设置为0。
缓存时间理论上没有上限限制,这个时间根据客户自身的需求设定,如果客户觉得其中一些文件,变更不频繁,那么就设置长一点。例如,文本类的js,css,html等可以设置得短一些,图片、视频音频类的可以设置的长一点(因为缓存时间会因文件热度算法,旧文件会被新文件替换掉,最长建议不要超过一个月)
如果要修改缓存规则,此项必填 |
cache-unitString | 缓存时间单位:设置缓存对象对应的时间单位:比如s、m、h、d。不输入单位默认是秒 |
ignore-cache-controlString | 忽略源站不缓存头。可选值为true和false,用于忽略请求头中cache-control的两种配置(private,no-cache)和客户端设置的Authorization。
ture表示会忽略掉源站对于这三者的设定。使得资源能够以cache-control: public的方式缓存在服务节点上,然后我们的节点才能缓存这种类型的资源,提供加速服务。
false表示当源站对某种资源设定了cache-control: private,cache-control:no-cache或指定根据authorization进行缓存时,我们的服务节点将不会对此类文件进行缓存。 |
publish-pointsList | 设置直播推拉流域名的发布点
注意:
1、拉流和对应的推流域名,必须配置相同的发布点;
2、不想修改发布点时,不要传入该节点及以下入参;
3、发布点采用覆盖式更新,每次修改时,需要提交全部发布点,不能仅提交需要修改的部分。 |
uriString | 发布点,支持多个,不传系统默认生成一条发布点uri为“/” |
| 参数名称 | 描述 |
|---|---|
codeString | Error code occurs when HTTPStatus is not 202, indicating the error type of the current request calls. |
messageString | Response information, demonstrates success when it is successful. |
| 错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
|---|---|---|---|
| InvalidParameter | The request has null config with null data-id, please remove it. | 400 | 请求的配置为空,数据ID为空,请将其删除。 |
| InternalError | Internal errors such as server exceptions, data acquisition failures, etc. | 500 | 服务器异常,数据获取失败等内部错误 |
| MalformedXML | The XML provided is incorrect or irregular | 400 | 提供的xml不正确或者不符合规则 |
| NoSuchDomain | The specified domain name does not exist | 404 | 指定的域名不存在 |
| Forbidden | Domain name deleted | 403 | 域名被删除 |
| ConfigError | Domain name change is not allowed | 400 | 不允许变更域名名称 |
| ConfigError | Domain name type is not allowed to be changed | 400 | 不允许变更域名类型 |
| ConfigError | No change to configuration sheet template ID is allowed | 400 | 不允许变更配置单模板id |
| ConfigError | Specified Configuration does not match Specified Shared Level 1 Domain Name | 409 | 指定配置与指定共用一级域名不匹配 |
| InvalidOrigin | Error in domain name attribute value | 400 | 域名属性值错误 |
| InvalidOrigin | origin domain names and accelerated domain names cannot be the same | 400 | 回源域名和加速域名不能相同 |
| InvalidOrigin | Illegal return ip/domain name | 400 | 回源ip/域名不合法 |
| InvalidOrigin | IP duplication | 400 | 回源ip重复 |
| InvalidOrigin | Package does not plan to return to source requests HOST | 400 | 套餐没有规划回源请求HOST |
| InvalidOrigin | HoST configuration error for backsource request | 400 | 回源请求HOST配置错误 |
| InvalidOrigin | Can't modify the advanced source of domain name | 400 | 不能修改域名的高级源 |
| CustomizedCnameError | Customized CNAME error. | 409 | 客户共用一级错误 |
| ConfigVersionOutOfDate | The version you provided has expired | 409 | 您提供的版本已经过期 |
| CnameError | Cname Error | 400 | 共用一级错误 |
| ConfigFormNotExists | Error in domain name service area entry parsing | 400 | 域名的服务区域入参解析错误 |
| NO_DOMAIN_2_UPDATE | Configuration does not exist | 400 | 配置不存在 |
| DOMAIN_NOT_USE_SSL | Configuration does not exist domain names without associated certificates | 400 | 域名没有关联证书 |
| NOT_SUPPORT_CERTIFICATE_CONFIG | Certificates must be used or cancelled at the same time | 400 | 使用证书必须同时使用或者同时取消 |
| NOT_SUPPORT_CERTIFICATE_CONFIG | Certificate types are inconsistent | 400 | 证书类型不一致 |
| NOT_SUPPORT_CERTIFICATE_CONFIG | Traditional (Sni) certificates are used, but multiple certificates are used | 400 | 使用传统(Sni)证书,但是使用的证书有多个 |
| NOT_SUPPORT_CERTIFICATE_CONFIG | Traditional certificates are used, but the certificates corresponding to cnamelabel are inconsistent with the certificates used | 400 | 使用传统证书,但是cnamelabel对应的证书与使用的证书不一致 |
| NO_AVAILABLE_HTTPS_SERVICE_FORM | There is no available httpps service order to switch | 400 | 没有可用的httpps服务单来切换 |
| NO_AVAILABLE_HTTPS_SERVICE_FORM | The product line of the current service order is not within the scope of allowing switching HTTPS service orders | 400 | 当前服务单的产品线不在允许切换https服务单的范围内 |
| NO_AVAILABLE_HTTPS_SERVICE_FORM | There is no package ID in the current service list | 400 | 当前服务单没有套餐id |
| NO_AVAILABLE_HTTPS_SERVICE_FORM | All domain names under the same configuration must use certificates at the same time. | 400 | 同一个配置单下的所有域名必须同时使用证书 |
| APPG_NAME_EMPTY | Application Service Group Check Failed (Application Service Group Name is Empty) | 400 | 应用服务组检查不通过(应用服务组名称为空) |
| APPG_NOT_SUPPORT_HTTPS_8_API | Application Service Group failed to check (Application Service Group does not open HTTPS self-service) | 400 | 应用服务组检查不通过(应用服务组不对外开放HTTPS自助) |
| APPG_NOT_SUPPORT_HTTPS | Application Service Group failed to check (Application Service Group does not open HTTPS self-service) | 400 | 应用服务组检查不通过(应用服务组不对外开放HTTPS自助) |
| SERVICE_TYPE_NOT_USE_SNI_SSL | Domain name configuration cannot use SNI certificates | 400 | 域名配置不能使用sni证书 |
| SUIT_HAS_NOT_CONFIG_CERTIFICATE_SERVICE | The service list is of HTTPS type, but the package does not have a certificate-related secondary service. | 400 | 服务单是https类型,但是所属套餐没有配置证书的相关二级服务 |
| ERROR_CONFIG_PARAM | Configuration Single Configuration Item Error | 400 | 配置单配置项错误 |
| CONFIG_NOT_OWN_DOMAIN_NAME | Cannot process the domain name | 400 | 不能处理该域名 |
| DUPLICATE_DOMAIN_NAME | Domain name duplication in entry | 400 | 入参中域名重复 |
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://api.cdnetworks.com/api/domain/a1.example.com" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '{
"comment": "my comment here",
"origin-config": {
"origin-ips": "1.1.1.0",
"default-origin-host-header": "a.example.com"
},
"ssl":{
"use-ssl":"",
"use-for-sni":"",
"ssl-certificate-id":""
},
"cache-behaviors": [{
"path-pattern": "/jpg",
"ignore-cache-control": "true",
"cache-ttl": "1800",
"cache-unit": "s"
}]
"header-of-clientip":"X-Forwarded-For"
}'HTTP/1.1 202 Accepted
Date: Fri, 17 May 2017 06:33:26 GMT
Content-Type: application/xml;charset=utf-8
x-cnc-request-id:c54cbbb4-19fe-407a-930c-3988b62ed2fd
x-cnc-deploy-version:1420084740000
{"message":"success"}