Set the Access IP of Real User
Last Updated:2020-09-17
The “Get real user IP” feature allows you to get the real IP address of the visit source or client IP address while using the CDN acceleration. This interface is used to set “Get real user IP ".
Method | Path | Description |
---|---|---|
PUT | /v2/domain/{domain}/config?clientIp | Enable or disable to "access the IP of real user” |
domain: CDN accelerated domain name.
Request body
Parameter | Optional | Type | Description |
---|---|---|---|
clientIp | Required | ClientIp | Enabled or disabled and IP type |
ClientIp:
Parameter | Optional | Type | Description |
---|---|---|---|
enabled | Required | bool | true means enabled, and false means disabled. |
name | Optional | string | You can set it as either “True-Client-Ip " or “X-Real-IP ", and the default is “True-Client-Ip ". When enabled is false, this item is meaningless. |
Response code (Http Status Code)
HTTP Status Code | Description |
---|---|
200 | Success |
400 | Update failures, parameter errors, etc. |
Request example
PUT /v2/domain/myself.baidu.com/config?clientIp HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 48
Content-Type: application/json
{
"clientIp": {
"enabled":true,
"name":"X-Real-IP"
}
}
Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
{
"status":"RUNNING"
}