tencent cloud

Feedback

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.
    )
    );
    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