跳转至

域名配置

POST 更新域名配置开关

POST /prod-api/cdn/domain/advancedConfigSwitch

用于开启或关闭域名某项功能开关(state0 / 1)。请先调用 查询域名配置开关 查看当前状态,再按需修改。

设置白名单、HTTP/3、TLS 等具体参数不在本接口配置,请使用 查询函数配置更新函数(见下方「与更新函数接口的分工」)。

Body 请求参数

{
  "type": "customRules",
  "domainId": 204,
  "state": 1
}

填写说明

字段 说明
domainId 域名 ID
state 开关状态:0 关闭,1 开启。取值与查询接口 data 中对应字段一致
type 要操作的配置项,与 查询域名配置开关 返回的 data 字段名一致(见下表)

type 与查询字段对照表

type(本接口传入) 查询接口 data 字段 中文名
httpHeader customHeader HTTP Header
brotli brotli Brotli 压缩
limitRate limitRate 下行限速
cacheRule cacheRule 缓存配置
advanced advanced 指定路径高级
falsify falsify 防篡改
infoReveal infoReveal 防信息泄露
httpIPWhitelist httpIPWhitelist HTTP 层 IP 白名单开关(与下方「设置白名单」无关)
sslsupport sslsupport 证书
bot bot 搜索引擎
http2 http2 HTTP/2
https_301 https_301 强制跳转 HTTPS
webSocket webSocket WebSocket
rangeSource rangeSource Range 回源
filterParameters filterParameters 过滤参数
customRules customRules 自定义规则
ipWhitelist ipWhitelist 设置白名单(仅开关,IP 列表见下方分工说明)
sysRegion sysRegion 地区 / 国家限制
whitelist whitelist 白名单
ruleWhite ruleWhite 规则白名单

注意:HTTP Header 在查询结果中为 customHeader,更新开关时 type 需传 httpHeader,与其余字段不同。

与「更新函数」接口的分工

本接口只改开/关;下列能力的具体配置(设置白名单、HTTP/3、TLS 版本等)请走 更新函数,查询现状请走 查询函数配置

能力 本接口(开关) 更新函数 functionName 说明
设置白名单 不支持(无对应 type IPWhitelist IP 列表仅通过 更新函数 写入,请求体 functions 示例见下方流程
HTTP/3 不支持(无对应 type http3 argNamestatusargValue0(开)或 1(关)
TLS 版本 不支持(无对应 type tls_version argNamestatusargValue01,含义见 查询函数配置

典型流程(设置白名单)

  1. 查询函数配置functionName: "IPWhitelist")→ 获取当前 IP 列表
  2. 更新函数 → 请求体示例:
{
  "domainId": 215,
  "functions": [
    {
      "functionArgs": [
        {
          "argName": "values",
          "argValue": "[\"1.1.1.1\",\"22.2.2.2\"]"
        }
      ],
      "functionName": "IPWhitelist"
    }
  ]
}
  • functionName 固定为 IPWhitelist
  • argName 固定为 values
  • argValue 为字符串,内容为 IP 数组的 JSON 形式(与查询返回一致)

查询结果中的超时时间、httpsStatusCode 等数值型配置不能通过本接口修改。

请求参数

名称 位置 类型 必选 中文名 说明
Authorization header string 鉴权 -
body body AdvancedConfigSwitchVo AdvancedConfigSwitchVo -

返回示例

200 Response

{
  "msg": "更新成功",
  "code": 200
}

返回结果

状态码 状态码含义 说明 数据模型
200 OK - Inline
201 Created - Inline
401 Unauthorized - Inline
403 Forbidden - Inline
404 Not Found - Inline

返回数据结构

状态码 200

名称 类型 必选 中文名 说明
» msg string 提示信息 -
» code integer 状态码 -

数据模型

AdvancedConfigSwitchVo

{
  "domainId": 204,
  "state": 1,
  "type": "customRules"
}

AdvancedConfigSwitchVo

属性

名称 类型 必选 中文名 说明
domainId integer(int64) 域名 ID -
state integer(int32) 开关状态 0:关闭;1:开启
type string 配置项 见上方「type 与查询字段对照表」