tencent cloud

All product documents
Cloud Object Storage
Setting Access Endpoints
Last updated: 2024-02-04 16:51:44
Setting Access Endpoints
Last updated: 2024-02-04 16:51:44

Overview

This document describes how to request the COS service by using a non-default domain name.

Custom Origin Server Domain Name

For more information, see Enabling Custom Origin Domain.
The sample code below shows how to access a COS service using a custom origin server domain name.

Sample code

// The bucket region can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket/. For more information on regions, visit https://www.tencentcloud.com/document/product/436/6224?from_cn_redirect=1.
let region = "ap-beijing"; // Bucket region
let customDomain = "exampledomain.com"; // Custom domain name
// Create a `CosXmlServiceConfig` object and modify the configuration parameters as needed
let cosXmlServiceConfig = {
region: region,
isDebuggable: false,
isHttps: true,
hostFormat: customDomain // Modify the requested domain name
};
// Register the default COS service
await Cos.registerDefaultService(cosXmlServiceConfig)

Global Acceleration Domain Name

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

Sample code

// The bucket region can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket/. For more information on regions, visit https://www.tencentcloud.com/document/product/436/6224?from_cn_redirect=1.
let region = "ap-beijing"; // Bucket region
let accelerate = true; // Enable the global acceleration endpoint
// Create a `CosXmlServiceConfig` object and modify the configuration parameters as needed
let cosXmlServiceConfig = {
region: region,
isDebuggable: false,
isHttps: true,
accelerate: accelerate
};
// Register the default COS service
await Cos.registerDefaultService(cosXmlServiceConfig)
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support