应用安全加速解决方案、IPv6一体化解决方案、电商安全加速解决方案、金融安全加速解决方案、政企安全加速解决方案、应用安全解决方案、区块链安全加速解决方案、IPv6安全加速解决方案、点播分发、直播分发、移动加速、网页加速、下载分发、全站加速
查看内部重定向配置
Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试
参数名称 | 描述 |
---|---|
*domain-nameString | 需要查询配置的域名或域名id |
参数名称 | 描述 |
---|---|
*rewrite-rule-settingsList | 一级服务改写替换—二级服务 内部重定向
注意:
1. 定义一组内部重定向内容,,如果有使用内部重定向内容,此项必填
2. 需要清空域名下的内容重定向内容,可以传入空节点 |
data-idLong | 添加grid类型标识,表示客户多组配置时,具体某组配置;data-id重复,已入参同个id最后一组为准生效
data-id可以通过查询接口获取。
注意:添加grid类型标识:data-id,每一组配置对应一个data-id:
a、如果客户有传data-id,说明指定修改其中一组配置项内容,不需求修改其他组配置内容不需要入参;
b、如果客户入参多组配置,其中有些组配置有传data-id,有些没有传,则有传data-id的表示修改具体某组配置,没有传data-id的表示在原来基础上新增一组配置;
c、如果客户入参都没有传data-id,表示用本次的配置全量覆盖原先配置;
d、如果客户入参没有传任何配置项参数,只传了域名和二级标签,表示清空这个接口对应域名二级服务所有配置。(c、d内容和当前方案实现一致);
e、一个gird标签下的入参不能为空,如果,没有具体的配置项,则data-id必填,且值为实际存在的data-id,表示清空这个data-id对应配置项的值; |
*path-patternString | url匹配模式,支持正则,客户入参参考:.*
对于匹配到的URL进行内容重定向 |
except-path-patternString | 例外的url匹配模式,某些URL除外:如abc.jpg,不做内容重定向
客户入参参考:^https?://[^/]+/.*\.m3u8 |
custom-patternString | 匹配条件:指定常用类型,可选值为all或homepage 1、all:全部文件 2、homepage:首页 |
directoryString | 目录 |
file-typeString | 匹配条件:文件类型,多个请以英文;分隔,可选值:gif png bmp jpeg jpg html htm shtml mp3 wma flv mp4 wmv zip exe rar css txt ico js swf m3u8 xml f4m bootstarp ts |
custom-file-typeString | 匹配条件:自定义文件类型,多个请以英文;分隔。 |
ignore-letter-caseString | 忽略大小写,可选值为true或false,true表示忽略大小写;false表示不忽略大小写;
新增配置项时,不传默认为 true
如果客户传了空值:如 |
*publish-typeString | 改写内容的生成位置。可输入值为:Cache表示节点;
暂不支持其他入参格式 |
priorityString | 表示客户多组重定向内容的优先执行顺序。数字越大,优先级越高。
新增配置项时,不传默认为 10 |
*before-valueString | 配置项:旧url
表示改写前的协议方式(即需要改写的对象),如:^https://([^/]+/.*)
如果是回源协议改写,则表示客户请求的原始url,配套的参数after-value,表示客户请求需要转换的回源请求。 |
*after-valueString | 配置项:新url
表示改写后的协议方式,如:http://$1
如果请求重定向带状态码则参考入参:301:https://$1
注:如果url含域名,则域名需要是本身。 |
*rewrite-typeString | 重定向类型;支持入参:
before:防盗链之前
after:防盗链之后 |
request-headerString | |
exception-request-headerString | |
specify-urlPredeployredirectconfigRequestRewriteRuleSettingsSpecifyUrl | |
uriString | |
match-query-stringString | |
query-stringsString | |
protocolString |
参数名称 | 描述 |
---|---|
preDeployIdString | 预部署任务的id,可以根据这个id查询预部署的进展和结果 |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
InvalidParameter | The url-pattern can't be empty. | 400 | url-pattern不能为空 |
InvalidParameter | The publish-type can't be empty. | 400 | publish-type不能为空 |
InvalidParameter | The before-value can't be empty. | 400 | before-value值不能为空 |
InvalidParameter | The after-value can't be empty. | 400 | after-value值不能为空 |
InvalidParameter | The rewrite-type can't be empty. | 400 | rewrite-type值不能为空 |
InvalidParameter | No rewrite-rule-settings was specified. | 400 | 未指定重写规则 |
InvalidParameter | No domain was specified. | 400 | 未指定域名 |
InvalidParameter | The ignore-letter-case is invalid. | 400 | ignore-letter-case无效 |
InvalidParameter | The publish-type is invalid. | 400 | publish-type无效 |
InvalidParameter | The priority is invalid. | 400 | 优先级无效 |
InvalidParameter | The rewrite-type is invalid. | 400 | rewrite-type无效 |
InvalidParameter | The path-pattern is required. | 400 | path-pattern无效 |
InvalidParameter | The publish-type is required. | 400 | publish-type无效 |
InvalidParameter | The before-value is required. | 400 | before-value必填 |
InvalidParameter | The after-value is required. | 400 | after-value必填 |
InvalidParameter | The rewrite-type is required. | 400 | rewrite-type必填 |
InvalidParameter | The request has null config with null data-id, please remove it. | 400 | 未指定重写规则。请求的配置为空,数据ID为空,请将其删除。 |
NoSuchDomain | The specified domain does not exist. | 404 | 指定域名不存在 |
InternalError | We encountered an internal error. Please try again. | 500 | 遇到内部错误,请重试。 |
ConfigError | The config {0} does not access. | 400 | 某个配置无法访问 |
CustomerNoOwnDomain | customer not own domain name. | 400 | 不是客户的域名 |
WrongDataId | Wrong data-id. | 400 | 错误的dataid |
#!/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/predeploy/InnerRedirect/a1.example.com" \ -X "PUT" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -H "Content-Type:application/json" \ -d '{ "rewrite-rule-settings": [ { "data-id": "31506537", "path-pattern": ".*", "except-path-pattern": "^https?://[^/]+/.*.m3u8", "ignore-letter-case": "true", "publish-type": "Cache", "priority": "10", "before-value": "^http://([^/]+/.*)", "after-value": "https://$1", "rewrite-type": "before" }, { "path-pattern": ".*", "except-path-pattern": "^https?://[^/]+/.*.m3u8", "ignore-letter-case": "true", "publish-type": "Cache", "priority": "9", "before-value": "http", "after-value": "https", "rewrite-type": "before" } ] }'
HTTP/1.1 202 OK Server: openresty/1.11.2.2 Date: Thu, 14 Mar 2019 08:09:45 GMT Content-Type: application/json;charset=utf-8 Content-Length: 31 Connection: keep-alive App-Name: service_confApi x-cnc-request-id: 86f908a5-3e45-4be3 {"preDeployId":"66201667e7424820b9e359671178757c"}