查看域名内部重定向配置

更新时间:2023-10-26 09:39:10

适用产品

应用安全加速解决方案、IPv6一体化解决方案、电商安全加速解决方案、金融安全加速解决方案、政企安全加速解决方案、应用安全解决方案、区块链安全加速解决方案、IPv6安全加速解决方案、点播分发、直播分发、移动加速、网页加速、下载分发、全站加速

接口描述

查看内部重定向配置

  • 调用URL: https://open.chinanetcenter.com/api/config/InnerRedirect/*
  • 调用方法:GET
  • 限制说明:· 加速域名必须已备案完成。 · 加速域名必须不包含如下信息:出售药物和管制刀具类,含有不法言论、信息。 · 视频类加速域名必须有视听许可证;博客论坛或社区类加速域名必须有BBS专项审批资质。 · 接口请求和返回结果接受xml和json格式。

调用频率

单用户调用频率:300/5min

推荐使用 Open API在线调试

Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试

请求参数

Path 参数

参数名称描述
*domain-nameString
需要查询配置的域名或域名id

返回参数

Body 参数

参数名称描述
domain-idString
需要查询配置的域名id
domain-nameString
需要查询配置的域名
rewrite-rule-settingsList
data-idString
添加grid类型标识,表示客户多组配置时,具体某组配置;data-id重复,已入参同个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
ignore-letter-caseString
忽略大小写,可选值为true或false,true表示忽略大小写;false表示不忽略大小写; 新增配置项时,不传默认为 true 如果客户传了空值:如,则表示清空配置
publish-typeString
改写内容的生成位置。可输入值为:Cache表示节点; 暂不支持其他入参格式
priorityNumber
表示客户多组重定向内容的优先执行顺序。数字越大,优先级越高。 新增配置项时,不传默认为 10
before-valueString
配置项:旧url 表示改写前的协议方式(即需要改写的对象),如:^https://([^/]+/.*)
after-valueString
配置项:新url 表示改写后的协议方式,如:http://$1
rewrite-typeString
重定向类型;支持入参: before:防盗链之前 after:防盗链之后
request-headerString
匹配条件:请求头
exception-request-headerString
匹配条件:例外的请求头

错误码

错误代码(code)描述(message)HTTP状态码语义
NoSuchDomainThe specified domain does not exist.404域名不存在
CustomerNoOwnDomaincustomer not own domain name[xxx]400客户没有该域名
WRONG_OPERATOROperator [$operator] not exist.400操作员不存在
WRONG_CUSTOMER_NAMEWrong customer name.400客户名称错误
WRONG_CUSTOMER_IDWrong customer id.400客户ID错误

示例

JSON
XML
JSON
请求示例
复制代码 复制成功
#!/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/InnerRedirect/a1.example.com" \
-X "GET" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json"
-H "Content-Type:application/json"
返回示例
复制代码 复制成功
HTTP/1.1 202 Accepted
Date: Fri, 17 May 2017 06:33:26 GMT
Content-Type: application/json;charset=utf-8
x-cnc-request-id:c54cbbb4-19fe-407a-930c-3988b62ed2fd
{
    "domain-id":"3797820",
    "domain-name":"www.web.1558604466417332.com",
    "rewrite-rule-settings":[
      {
        "after-value":"https://$1",
        "before-value":"^http://([^/]+/.*)",
        "data-id":31506537,
        "except-path-pattern":"^https?://[^/]+/.*.m3u8",
        "ignore-letter-case":"true",
        "path-pattern":".*",
        "priority":"10",
        "publish-type":"Cache",
        "rewrite-type":"before"
      },
      {
        "after-value":"https",
        "before-value":"http",
        "data-id":31506539,
        "except-path-pattern":"^https?://[^/]+/.*.m3u8",
        "ignore-letter-case":"true",
        "path-pattern":".*",
        "priority":"9",
        "publish-type":"Cache",
        "rewrite-type":"before"
      }
    ]
  }
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!