回源配置接口
更新时间:2023-05-16
更新加速域名回源地址
public void setDomainOrigin(CdnClient client) {
String domain = "my.test.com";
SetDomainOriginRequest request = new SetDomainOriginRequest().withDomain(domain).withFollow302(true);
ArrayList<OriginPeer> origin = new ArrayList<OriginPeer>();
origin.add(new OriginPeer().withPeer("3.4.5.6").withHost("a.com").withWeight(50).withIsp("un"));
origin.add(new OriginPeer().withPeer("5.4.3.2").withHost("a.com").withWeight(50).withIsp("ct"));
request.setOrigin(origin);
client.setDomainOrigin(request);
}
查询加速域名回源地址
public void getDomainOrigin(CdnClient client) {
String domain = "my.test.com";
GetDomainOriginResponse resp = client.getDomainOrigin(domain);
}
设置Range回源
public void setDomainRangeSwitch(CdnClient client){
String domain = "my.test.com";
client.setDomainRangeSwitch(domain, true);
}
查询Range回源
public void getDomainRangeSwitch(CdnClient client){
String domain = "my.test.com";
GetDomainRangeSwitchResponse response = client.getDomainRangeSwitch(domain);
}
设置获取真实用户IP
public void setDomainClientIp(CdnClient client){
String domain = "my.test.com";
SetDomainClientIpRequest request = new SetDomainClientIpRequest()
.withDomain(domain)
.withClientIp(new ClientIp().withEnabled(true).withName("X-Real-IP));
CommonResponse response = client.setDomainClientIp(request);
System.out.println(response.getStatus())
}
查询获取真实用户IP
public void getDomainClientIp(CdnClient client){
String domain = "my.test.com";
GetDomainClientIpResponse response = client.getDomainClientIp(domain);
}
设置回源协议
public void setDomainOriginProtocol(CdnClient client){
String domain = "my.test.com";
OriginProtocol originProtocol = new OriginProtocol().withValue("http");
client.setDomainOriginProtocol(new SetDomainOriginProtocolRequest()
.withDomain(domain)
.withOriginProtocol(originProtocol));
}
查询回源协议
public void getDomainOriginProtocol(CdnClient client){
String domain = "my.test.com";
GetDomainOriginProtocolResponse response = client.getDomainOriginProtocol(domain);
}
设置回源错误重试条件
public void setDomainRetryOrigin(CdnClient client){
String domain = "my.test.com";
RetryOrigin retryOrigin = new RetryOrigin().addCode(500).addCode(504);
SetDomainRetryOriginRequest request = new SetDomainRetryOriginRequest().withDomain(domain).withRetryOrigin(retryOrigin);
client.setDomainRetryOrigin(request);
}
查询回源错误重试条件
public void getDomainRetryOrigin(CdnClient client) {
String domain = "my.test.com";
GetDomainRetryOriginResponse response = client.getDomainRetryOrigin(domain);
}
设置回源超时
public void setDomainOriginTimeout(CdnClient client){
String domain = "my.test.com";
SetDomainOriginTimeoutRequest request = new SetDomainOriginTimeoutRequest()
.withDomain(domain)
.withOriginTimeout(new OriginTimeout(6, 10))
client.setDomainOriginTimeout(request);
}
查询回源超时
public void getDomainOriginTimeout(CdnClient client) {
String domain = "my.test.com";
GetDomainOriginTimeoutResponse response = client.getDomainOriginTimeout(domain);
}
设置同运营商回源
public void setDomainOriginFixedISP(CdnClient client){
String domain = "my.test.com";
SetDomainOriginFixedIspRequest request = new SetDomainOriginFixedIspRequest()
.withDomain(domain)
.withOriginFixedISP(true)
client.setDomainOriginFixedISP(request);
}
查询同运营商回源
public void getDomainOriginFixedISP(CdnClient client) {
String domain = "my.test.com";
GetDomainOriginFixedIspResponse response = client.getDomainOriginFixedISP(domain);
}