tencent cloud

All product documents
Cloud Object Storage
DocumentationCloud Object StorageSDK DocumentationPHP SDKSetting Access Domain Names (CDN/Global Acceleration)
Setting Access Domain Names (CDN/Global Acceleration)
Last updated: 2024-02-04 14:25:57
Setting Access Domain Names (CDN/Global Acceleration)
Last updated: 2024-02-04 14:25:57

Overview

This document describes how to use a non-default domain to request COS.

Parameter Description

You can use the initialization parameters below to control the request domain:
Parameter
Description
Type
Required
Domain
The custom request domain name used to call a bucket or object API. You can use a template, such as "{$Bucket}.cos.{$Region}.myqcloud.com" which will use the bucket and region passed in the replacement parameters when an API is called.
String
No
Protocol
The protocol used when the request is made. Valid values: https:, http:. By default, http: is used when the current page is determined to be in `http: format; otherwise, https: is used
String
No

Default CDN Acceleration Domain Name

The sample code below shows how to access a COS service using a default CDN acceleration domain name.
$bucket = "examplebucket-1250000000";

$cosClient = new Qcloud\\Cos\\Client(
array(
'domain' => $bucket . '.file.myqcloud.com', // Default acceleration domain name
'schema' => 'https', // Protocol, http by default
'credentials'=> array(
'secretId' => $secretId,
'secretKey' => $secretKey
)
)
);

Custom CDN Acceleration Domain Name

The sample code below shows how to access a COS service using a custom CDN acceleration domain name.
$cosClient = new Qcloud\\Cos\\Client(
array(
'domain' => 'example-cdn-domain.com', // Default acceleration domain name
'schema' => 'https', // Protocol, http by default
'credentials'=> array(
'secretId' => $secretId,
'secretKey' => $secretKey
)
)
);

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.
$cosClient = new Qcloud\\Cos\\Client(
array(
'domain' => 'example-cos-domain.com', // Default acceleration domain name
'schema' => 'https', // Protocol, http by default
'credentials'=> array(
'secretId' => $secretId,
'secretKey' => $secretKey
)
)
);

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.
// Change {$bucket}.cos.{$region}.myqcloud.com/key to the one below:
//{$bucket}.cos.accelerate.myqcloud.com/key
$cosClient = new Qcloud\\Cos\\Client(
array(
'schema' => 'https', // Protocol header, which is http by default
'credentials'=> array(
'secretId' => $secretId,
'secretKey' => $secretKey
),
'allow_accelerate' => true // Set this parameter to “true” to use a global acceleration domain.
)
);
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 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon