访问配置接口
所有文档

          内容分发网络 CDN

          访问配置接口

          设置访问Referer控制

          public void setDomainRefererACL(CdnClient client, String domainName) {
              RefererACL acl = new RefererACL()
                          .addBlackList("http://a.com")
                          .addBlackList("http://b.com").withAllowEmpty(true);
                  SetDomainRefererACLRequest request = new SetDomainRefererACLRequest()
                          .withDomain(domainName)
                          .withRefererACL(acl);
                  client.setDomainRefererACL(request);
          }

          查询访问Referer控制

          public void getDomainRefererACL(CdnClient client, String domainName) {
              GetDomainRefererACLResponse response = client.getDomainRefererACL(domainName);
          }

          设置访问IP控制

          public void setDomainIpACL(CdnClient client, String domainName) {
              IpACL acl = new IpACL()
                          .addBlackList("1.2.3.4")
                          .addBlackList("5.6.7.0/24");
                  SetDomainIpACLRequest request = new SetDomainIpACLRequest()
                          .withDomain(domainName)
                          .withIpACL(acl);
                  client.setDomainIpACL(request);
              }

          查询访问IP控制

           public void getDomainIpACL(CdnClient client, String domainName){
                GetDomainIpACLResponse response = client.getDomainIpACL(domainName);
              }

          设置访问鉴权

          public void setRequestAuth(CdnClient client, String domainName) {
               RequestAuth requestAuth = new RequestAuth()
                          .withType("a")
                          .withKey1("secretkey1");
                  SetRequestAuthRequest request = new SetRequestAuthRequest()
                          .withDomain(domainName)
                          .withRequestAuth(requestAuth);
                  client.setRequestAuth(request);
              }

          设置域名限速

           public void setTrafficLimit(CdnClient client, String domainName) {
                  TrafficLimit trafficLimit = new TrafficLimit().withEnable(true)
                          .withLimitRate(10485760).withLimitStartHour(10).withLimitEndHour(19).withLimitRateAfter(0)
                          .withTrafficLimitArg("rate").withTrafficLimitUnit("m");
                  SetDomainTrafficLimitRequest request = new SetDomainTrafficLimitRequest().withDomain(domainName)
                          .withTrafficLimit(trafficLimit);
                  client.setDomainTrafficLimit(request);
              }

          查询域名限速

           public void getTrafficLimit(CdnClient client, String domainName) {
                  GetDomainTrafficLimitResponse resp = client.getTrafficLimit(domainName);
              }

          设置Cors跨域

           public void setCorsConfig(CdnClient client, String domainName){
                  Cors cors = new Cors().withAllow("on")
                          .addOriginList("http://www.baidu.com").addOriginList("http://*.bce.com");
                  client.setDomainCors(new SetDomainCorsRequest()
                          .withDomain(domainName).withCors(cors));
              }

          查询Cors跨域

           public void getCorsConfig(CdnClient client, String domainName){
                  GetDomainCorsResponse response = client.getDomainCors(domainName);
              }

          设置IP访问限频

           public void setAccessLimit(CdnClient client, String domainName){
              AccessLimit accessLimit = new AccessLimit().withLimit(200).withEnabled(true);
              client.setDomainAccessLimit(new SetDomainAccessLimitRequest()
                          .withDomain(domainName).withAccessLimit(accessLimit));
              }

          查询IP访问限频

           public void getAccessLimit(CdnClient client, String domainName){
                  GetDomainAccessLimitResponse response = client.getDomainAccessLimit(domainName);
              }

          设置获取真实用户IP

          public void setDomainClientIp(CdnClient client, String domainName){
                  ClientIp clientIp = new ClientIp().withEnabled(true).withName("X-Real-IP");
                  client.setDomainClientIp(new SetDomainClientIpRequest()
                          .withDomain(domainName).withClientIp(clientIp));
              }

          查询获取真实用户IP

          public void getDomainClientIp(CdnClient client, String domainName){
                  GetDomainClientIpResponse response = client.getDomainClientIp(domainName);
              }

          设置访问ua控制

           public void setUaAcl(CdnClient client, String domainName){
              UaAcl uaAcl = new UaAcl().addBlackList("MQQBrowser/5.3/Mozilla/5.0")
                          .addBlackList("Mozilla/5.0 (Linux; Android 7.0");
              client.setDomainUaAcl(new SetDomainUaAclRequest().withDomain(domainName)
                          .withUaAcl(uaAcl));
              }

          查询访问ua控制

          public void getDomainUaAcl(CdnClient client, String domainName){
                  GetDomainUaAclResponse response = client.getDomainUaAcl(domainName);
              }
          上一篇
          缓存配置接口
          下一篇
          回源配置接口