修改源站池接口
更新时间:2026-10-14
接口
本接口用于修改站点所属的源站池。
请求接口
| Method | Path | 说明 |
|---|---|---|
| POST | /v2/geo/origin-pool?action=update | 修改源站池 |
请求体
| 字段名称 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| site | String | 是 | 站点名称 |
| originPoolId | String | 是 | 源站池Id |
| originPool | Object<OriginPool> | 是 | 源站池配置 |
OriginPool 类型说明
| 字段名称 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| name | String | 是 | 源站池名称,支持大小写字母、数字及特殊字符,限制长度为0-120 |
| originConfig | Array<OriginConfig> | 是 | 源站配置 |
OriginConfig 类型说明
(1) IP 或 域名源站类型
| 字段名称 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| addr | String | 是 | 源站地址。支持 IPv4、IPv6 形式的 IP 地址,或者域名,不能重复 |
| type | String | 是 | 源站类型。可选值为 “IP”、“DOMAIN” |
| host | String | 否 | 回源时使用的 host 值 |
| weight | Int | 是 | 源站权重,值为 1-100 之间的整数。默认值为 50 |
(2)对象存储类型
| 字段名称 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| addr | String | 是 | BOS 的 bucket 名称或 S3 对象存储的源站地址 |
| type | String | 是 | 源站类型。可选值为 “BUCKET”、“DOMAIN”,BOS 使用 “BUCKET”,S3 使用 “DOMAIN” |
| host | String | 否 | 回源时使用的 host 值 |
| weight | Int | 是 | 源站权重,值为 1-100 之间的整数。默认值为 50 |
| thirdBucketAuth | Object<ThirdBucketAuth> | 是 | 对象存储的鉴权配置 |
ThirdBucketAuth 类型说明
| 字段名称 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| authType | String | 是 | 鉴权类型,当前支持 AWS S3 以及 BOS。其合法值为:“aws_v2”、“aws_v4”、“bos” |
| enabled | Bool | 是 | 私有访问鉴权的开关,其合法值为 “true”、“false” |
| ak | String | 否 | 只针对 S3 鉴权类型生效,开启私有访问鉴权时必须输入该值,对象存储的访问密钥 Access Key |
| sk | String | 否 | 只针对 S3 鉴权类型生效,开启私有访问鉴权时必须输入该值,对象存储的私有访问密钥 Secret Access Key |
| bucket | String | 否 | 只针对 S3 鉴权类型生效,对象存储的 bucket。 • aws_v2:必须设置 • aws_v4:无需设置 |
| region | String | 否 | 只针对 S3 鉴权类型生效,对象存储的区域。 • aws_v2:无需设置 • aws_v4:选填,默认区域为 “us-east-1” |
| service | String | 否 | 只针对 S3 鉴权类型生效,对象存储的服务。 • aws_v2:无需设置 • aws_v4:选填,默认服务为 “s3” |
注:
- 每个站点最多支持创建50个源站池,每个源站池最多支持创建20个源站。
- 针对 BOS 对象存储类型:ak、sk、bucket、region、service 这几个字段创建时无需传值。
- 关于“无需设置”:指该字段无效,即使在配置中设置了值,也不会生效。
响应码
| HTTP Status Code | 说明 |
|---|---|
| 200 | 修改成功 |
| 400 | 源站池修改请求参数无效 |
| 500 | 服务端错误 |
响应体
| 参数 | 类型 | 说明 |
|---|---|---|
| success | Bool | 修改源站池成功 |
请求示例
Plain Text
1POST /v2/geo/origin-pool?action=update HTTP/1.1
2Host: geo.baidubce.com
3Authorization: xxx
4Content-Type: application/json;charset=utf-8
5Accept-Encoding: gzip
6{
7 "site": "test-eo.com",
8 "originPoolId": "geo_LGKm6ryALtnO",
9 "originPool": {
10 "name": "test",
11 "originConfig": [
12 {
13 "addr": "your.bos.bucket1.name",
14 "type": "BUCKET",
15 "host": "test.host.com",
16 "weight": 50,
17 "thirdBucketAuth": {
18 "authType": "bos",
19 "enabled": false
20 }
21 },
22 {
23 "addr": "your.bos.bucket2.name",
24 "type": "BUCKET",
25 "host": "test.host.com",
26 "weight": 50,
27 "thirdBucketAuth": {
28 "authType": "bos",
29 "enabled": true
30 }
31 },
32 {
33 "addr": "test.s3.com",
34 "type": "DOMAIN",
35 "host": "test.host.com",
36 "thirdBucketAuth": {
37 "authType": "aws_v4",
38 "enabled": true,
39 "ak": "your ak",
40 "sk": "your sk",
41 "bucket": "your bucket"
42 },
43 "weight":50
44 },
45 {
46 "addr": "test.origin.com",
47 "type": "DOMAIN",
48 "weight": 50,
49 "host": "test.host.com"
50 },
51 {
52 "addr": "1.2.3.4",
53 "type": "IP",
54 "weight": 50,
55 "host": "test.host.com"
56 }
57 ]
58 }
59}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.16.1
3Content-Type: application/json; charset=utf-8
4Transfer-Encoding: chunked
5Connection: keep-alive
6{
7 "success": true
8}
评价此篇文章
