tencent cloud

Setting Access Domain Names (CDN/Global Acceleration)
Last updated: 2024-01-23 17:15:08
Setting Access Domain Names (CDN/Global Acceleration)
Last updated: 2024-01-23 17:15:08

Overview

This document describes how to request COS service using a domain/endpoint other than default COS endpoints.

SDK API Reference

For the parameters and method descriptions of all the APIs in the SDK, please see SDK API Reference.

Default CDN Acceleration Domain Name

The sample code below shows how to access COS service using a default CDN acceleration domain name.

Sample code

Objective-C
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] init];
endpoint.suffix = @"file.myqcloud.com";
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint();
endpoint.suffix = "file.myqcloud.com";
Note:
For the complete sample, go to GitHub.

Custom CDN Acceleration Domain Name

The sample code below shows how to access COS service using a custom CDN acceleration domain name.

Sample code

Objective-C
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:@"exampledomain.com"]];
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint.init(literalURL: NSURL.init(string: "exampledomain.com") as URL?);
Note:
For the complete sample, go to GitHub.

Custom Endpoint

For more information, see Enabling Custom Endpoints.
The sample code below shows how to access COS service using a custom endpoint.

Sample code

Objective-C
NSString *customDomain = @"exampledomain.com"; // Custom endpoint
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:customDomain]];
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint.init(literalURL: NSURL.init(string: "exampledomain.com") as URL?);
Note:
For the complete sample, go to GitHub.

Global Acceleration Endpoint

For more information on global acceleration, see Overview.
The sample code below shows how to access COS service using a global acceleration endpoint.

Sample code

Objective-C
QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc]init];
endpoint.suffix = @"cos.accelerate.myqcloud.com";
Note:
For the complete sample, go to GitHub.
Swift
let endpoint = QCloudCOSXMLEndPoint();
endpoint.suffix = "cos.accelerate.myqcloud.com";
Note:
For the complete sample, go to GitHub.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback