设置用户ip获取配置
更新时间:2026-09-02
接口
本接口用于设置站点的用户 ip 获取配置。
请求接口
| Method | Path | 说明 |
|---|---|---|
| PUT | /v2/geo/site/{site}/config | 设置用户 ip 获取配置接口 |
site:表示要设置的站点。
请求体
| 参数 | 类型 | 可选 | 说明 |
|---|---|---|---|
| realIp | List<RealIp> | 必选 | 用户 ip 获取配置。 |
响应码
| HTTP Status Code | 说明 |
|---|---|
| 200 | 设置用户 ip 获取配置成功 |
| 其他错误码 | 配置参数错误 |
响应体
| 参数 | 类型 | 说明 |
|---|---|---|
| status | String | 表示修改该配置的状态。设置配置成功,其值为“RUNNING”。否则返回报错信息。 |
请求示例1:设置 True-Client-Ip
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "realIp": {
10 "enabled": true,
11 "name": "True-Client-Ip"
12 }
13}
请求示例2:设置 X-Real-IP
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "realIp": {
10 "enabled": true,
11 "name": "X-Real-IP"
12 }
13}
请求示例3:关闭用户 ip 获取
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "realIp": {
10 "enabled": false
11 }
12}
响应示例
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{
8 "status": "RUNNING"
9}
评价此篇文章
