下载分发、全站加速、应用安全加速解决方案、IPv6一体化解决方案、电商安全加速解决方案、金融安全加速解决方案、政企安全加速解决方案、应用安全解决方案、区块链安全加速解决方案、IPv6安全加速解决方案、点播分发、直播分发、移动加速、网页加速
通过接口自助实现遵循源站缓存规则,有缓存头的时候按源站缓存头缓存,无缓存头时不缓存。
Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试
参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|
domain-name | String | 是 | 需要查询配置的域名或域名id |
参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|
cache-by-respheaders | List | 是 | 根据响应头内容缓存文件
注意:
1、需要取消根据响应头内容缓存文件配置设置时,可以传入空节点 |
data-id | Long | 否 | 添加grid类型标识,表示客户多组配置时,具体某组配置 如果是新增一组配置项的值时,不需要传。如果指定修改具体data-id的配置项值时,需要传入对应配置项对应的data-id.可以通过查询接口获取 |
response-header | String | 是 | 响应头头部名称 需要缓存的响应头名称。如Cache-Control |
path-pattern | String | 否 | url匹配模式,支持正则,如果是全部匹配,入参可以配置为:.* |
except-path-pattern | String | 否 | 例外的url匹配模式,某些URL除外:如abc.jpg,不做内容重定向 客户入参参考:^https?://[^/]+/.*\.m3u8 |
response-value | String | 是 | 头部值。 |
ignore-letter-case | String | 否 | 忽略大小写,可选值为true或false,true表示忽略大小写;false表示不忽略大小写; 新增配置项时,不传默认为 true |
priority | String | 否 | 表示客户多组重定向内容的优先执行顺序。数字越大,优先级越高。 新增配置项时,不传默认为 10 如果传了值,为清空配置 |
is-respheader | String | 是 | 是否允许响应头内容缓存文件,可选值为true或false,true表示允许响应头内容缓存文件;false表示不允许响应头内容缓存文件; |
参数名称 | 类型 | 描述 |
---|---|---|
http status code | Integer | httpstatus=202; 表示成功调用新增域名接口,可使用header中的x-cnc-request-id查看当前新增域名的部署情况 |
x-cnc-request-id | String | 唯一标示的id,用于查询每次请求的任务 (适用全部接口) |
code | String | 错误代码,当HTTPStatus不为202时出现,表示当前请求调用的错误类型 |
message | String | 响应信息,成功时为success |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
InvalidParameter | The request has null config with null data-id, please remove it. | 400 | 其他属性都为空,dataId不能为空 |
InvalidParameter | No cache-by-respheaders was specified. | 400 | cache-by-respheaders 没有传入或者为空 |
InvalidParameter | No response-header was specified. | 400 | response-header 没有传入或者为空 |
InvalidParameter | No response-value was specified. | 400 | response-value 没有传入或者为空 |
InvalidParameter | No is-respheader was specified. | 400 | is-respheader 没有传入或者为空 |
InvalidParameter | The is-respheader is invalid. | 400 | is-respheader 字段规范错误 |
InvalidParameter | The ignore-letter-case is invalid. | 400 | ignore-letter-case 字段规范错误 |
InvalidParameter | The priority is invalid. | 400 | priority 字段规范错误 |
#!/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://open.chinanetcenter.com/api/config/cachebyrespheader/123344" \ -X "PUT" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -H "Content-Type:application/json" \ -d '{ "cache-by-respheaders":[ { "except-path-pattern":"*", "ignore-letter-case":"true", "is-respheader":"false", "path-pattern":"*", "priority":"10", "response-header":"Cache-Control", "response-value":".*" } ] }'
HTTP/1.1 202 Accepted Server: openresty/1.11.2.2 Date: Mon, 27 May 2019 07:44:08 GMT Content-Type: application/json;charset=utf-8 Content-Length: 31 Connection: keep-alive App-Name: service_confApi x-cnc-request-id: b91c5024-b277-4f7e {"message":"success","code":""}