访问控制
更新时间:2023-05-16
设置访问Referer控制
PHP
1$domain = "test.domain.com";
2$aclList = array(
3 "http://your.black.list1",
4 "http://your.black.list2"
5);
6$flag = "black";
7$allowEmpty=true;
8$resp = $this->client->setDomainRefererAcl($domain, $flag, $allowEmpty, $aclList);
9print_r($resp);
设置访问Ip控制
PHP
1$domain = "test.domain.com";
2$aclList = array(
3 "1.2.3.4",
4 "5.6.7.8"
5);
6$flag = "white";
7$resp = $this->client->setDomainIpAcl($domain, $flag, $aclList);
8print_r($resp);
设置单链接限速
PHP
1$domain = "test.domain.com";
2// 单位为Bytes
3$rate = 1024;
4$resp = $client->setDomainLimitRate($domain, $rate);
5print_r($resp);
设置访问鉴权
PHP
1$requestAuth = array(
2 'requestAuth' => array(
3 "type" => "c",
4 "key1" => "secretekey1",
5 "key2" => "secretekey2",
6 "timeout" => 300,
7 "whiteList" => array("/crossdomain.xml"),
8 "signArg" => "sign",
9 "timeArg" => "t"
10 )
11);
12
13$client = new CdnClient($g_CDN_TEST_CONFIG);
14$domain = "test-sdk.sys-qa.com";
15$resp = $client->setDomainRequestAuth($domain, $requestAuth);
16print_r($resp);
设置 cors 跨域
PHP
1$cors = array(
2 'cors' => array(
3 "allow" => "on",
4 'originList' => array(
5 "www.baidu.com",
6 )
7 )
8);
9
10$client = new CdnClient($g_CDN_TEST_CONFIG);
11$domain = "test-sdk.sys-qa.com";
12$resp = $client->setDomainCors($domain, $cors);
13print_r($resp);
查询 cors 跨域
PHP
1$client = new CdnClient($g_CDN_TEST_CONFIG);
2$domain = "test-sdk.sys-qa.com";
3$resp = $client->getDomainCors($domain);
4print_r($resp);
设置 ip 访问限频
PHP
1$accessLimit = array(
2 'accessLimit' => array(
3 "enabled" => true,
4 "limit" => 200
5 )
6);
7
8$client = new CdnClient($g_CDN_TEST_CONFIG);
9$domain = "test-sdk.sys-qa.com";
10$resp = $client->setDomainAccessLimit($domain, $accessLimit);
11print_r($resp);
查询 ip 访问限频
PHP
1$client = new CdnClient($g_CDN_TEST_CONFIG);
2$domain = "";
3print_r($domain);
设置获取用户真实ip
PHP
1$clientIp = array(
2 'clientIp' => array(
3 "enabled" => true,
4 "name" => "X-Real-IP"
5 )
6);
7
8$client = new CdnClient($g_CDN_TEST_CONFIG);
9$domain = "test-sdk.sys-qa.com";
10$resp = $client->setDomainClientIp($domain, $clientIp);
11print_r($resp);
查询获取用户真实ip
PHP
1$client = new CdnClient($g_CDN_TEST_CONFIG);
2$domain = "test-sdk.sys-qa.com";
3$resp = $client->getDomainClientIp($domain);
4print_r($resp);