Overview
This document describes how to request the COS service by using a non-default domain name.
Custom Origin Server Domain Name
The sample code below shows how to access a COS service using a custom origin server domain name.
Sample code
String region = "ap-beijing";
String customDomain = "exampledomain.com";
CosXmlServiceConfig serviceConfig = CosXmlServiceConfig(
region: region,
isDebuggable: false,
isHttps: true,
hostFormat: customDomain
);
Cos().registerDefaultService(serviceConfig);
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
String region = "ap-beijing";
bool accelerate = true;
CosXmlServiceConfig serviceConfig = CosXmlServiceConfig(
region: region,
isDebuggable: false,
isHttps: true,
accelerate: accelerate
);
Cos().registerDefaultService(serviceConfig);
Was this page helpful?