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