Set the Mobile Access Control
Last Updated:2020-09-17
Baidu AI Cloud CDN enables CDN users to manage the distribution of resource contents on the mobile end/PC end in a targeted and differentiated manner by judging the User-Agent in the request by enabling the mobile access switch, and such interface is used to enable or disable this function.
| Method | Path | Description |
|---|---|---|
| PUT | /v2/domain/{domain}/config?mobileAccess | Enable or disable targeted delivery of resource content requested by the origin (mobile or PC). |
domain: CDN accelerated domain name.
Request body
| Parameter | Optional | Type | Description |
|---|---|---|---|
| mobileAccess | Required | MobileAccess | Mobile access control |
MobileAccess:
| Parameter | Optional | Type | Description |
|---|---|---|---|
| distinguishClient | Required | bool | true means having targeted delivery of resource content requested by the origin (mobile or PC), and false means no special targeted delivery. |
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?mobileAccess HTTP/1.1
Host: cdn.baidubce.com
Content-Length: 44
Content-Type: application/json
{
"mobileAccess":{
"distinguishClient":true
}
} Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
{
"status":"RUNNING"
} 