Configures one or more accelerated domains.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes BatchSetDcdnDomainConfigs

The operation that you want to perform. Set the value to BatchSetDcdnDomainConfigs.

DomainNames String Yes example.com

The name of the accelerated domain for which you want to configure features. You can specify multiple accelerated domain names and separate them with commas (,).

Functions String Yes [{"functionArgs":[{"argName":"domain_name","argValue":"example.com"}],"functionName":"set_req_host_header"}]
The list of features.
[{"functionArgs":[{"argName":"Parameter name","argValue":"Parameter value"}],"functionName":"Feature name"}]
.

Each value of the Functions parameters must be a string.

Some features, such as filetype_based_ttl_set, support more than one configuration record. To update one of the configuration records, use the configId parameter to specify the record.

[{"functionArgs":[{"argName":"file_type","argValue":"jpg"},{"argName":"ttl","argValue":"18"}],"functionName":"filetype_based_ttl_set","configId":5068995}]

The following table describes the features.

Feature

Parameter description

referer_white_list_set: specifies the referer whitelist.

refer_domain_allow_list: specifies the referers to be added to the whitelist. Separate multiple referers with commas (,).

allow_empty: specifies whether requests that have empty referer headers are allowed to access Content Delivery Network (CDN) resources. Valid values: on and off.

referer_black_list_set: specifies the referer blacklist.

refer_domain_deny_list: specifies the referers to be added to the blacklist. Separate multiple referers with commas (,).

allow_empty: specifies whether requests that have empty referer headers are allowed to access CDN resources. Valid values: on and off.

filetype_based_ttl_set: specifies an expiration rule for specific files.

ttl: specifies the validity period of the cached resources. Unit: second.

file_type: specifies the file type. You can specify one or more file types. Separate multiple file types with commas (,). Example: txt,jpg.

path_based_ttl_set: specifies an expiration rule for specific directories.

ttl: specifies the validity period of the cached resources. Unit: second.

path: specifies the directory. It must start with a forward slash (/).

oss_auth: authenticates the access to Object Storage Service (OSS) buckets.

oss_bucket_id: specifies the ID of the bucket.

ip_black_list_set: specifies the IP address blacklist.

ip_list: specifies the IP addresses to be added to the blacklist. Separate multiple IP addresses with commas (,).

ip_allow_list_set: specifies the IP address whitelist.

ip_list: specifies the IP addresses to be added to the whitelist. Separate multiple IP addresses with commas (,).

error_page: redirects an error page to a specified page.

error_code: specifies the error code.

rewrite_page: specifies the page to be redirected to when the specified error occurs.

set_req_host_header: modifies the custom header of back-to-origin requests.

domain_name: specifies the custom domain name that is used as the origin host.

set_hashkey_args: reserves specified URL parameters.

hashkey_args: specifies the parameters to be reserved. Separate multiple parameters with commas (,). You can specify up to 10 parameters.

disable: specifies whether to ignore all the parameters. A value of on indicates that all the parameters are ignored. A value of off indicates that no parameters are ignored. The hashkey_args setting has a higher priority than this setting. Even if you have set this setting to on, the parameters specified in hashkey_args are reserved.

keep_oss_args: specifies whether to reserve all the origin parameters in back-to-origin requests. A value of on indicates that all the origin parameters in back-to-origin requests are reserved. A value of off indicates that only the parameters specified in hashkey_args are reserved.

aliauth: configures Alibaba authentication.

auth_type: specifies the authentication type. Valid values: no_auth, type_a, type_b, and type_c.

auth_key1: specifies the primary key. auth_key2: specifies the secondary key.

ali_auth_delta: specifies the custom buffer time for authentication.

set_resp_header: specifies a response header. To verify the setting, you can check the response messages on the client through the browser.

key: specifies the name of the response header. Valid values: Content-Type, Cache-Control, Content-Disposition, Content-Language, Expires, Access-Control-Allow-Origin, Access-Control-Allow-Methods, Access-Control-Allow-Headers, Access-Control-Max-Age, and Access-Control-Expose-Headers.

value: specifies the value of the response header. Enter null if you need to delete the header.

https_force: redirects the original requests from a client to L1 as HTTPS requests.

enable: specifies whether to enable the feature. Valid values: on and off.

http_force: redirects the original requests from a client to L1 as HTTP requests.

enable: specifies whether to enable the feature. Valid values: on and off.

https_option: specifies basic parameters of HTTPS.

http2: specifies whether to enable HTTP/2. Valid values: on and off.

forward_scheme: configures the static origin protocol policy.

enable: specifies whether to enable the feature. Valid values: on and off.

scheme_origin: specifies the protocol policy that is used to communicate with the origin server. Valid values: http, https, and follow.

green_manager: configures pornography detection.

enable: specifies whether to enable the feature. Valid values: on and off.

dynamic: configures the Dynamic Route for CDN (DCDN) service.

enable: specifies whether to enable the feature. This parameter is required. Valid values: on and off.

static_route_type: specifies the file extension for static content.

static_route_url: specifies the URI of static content.

static_route_path: specifies the path of static content.

dynamic_route_origin: specifies the protocol policy that is used to communicate with the origin server. Valid values: http, https, and follow.

dynamic_route_round_robin: specifies whether to enable load balancing. Valid values: on and off.

set_req_header: customizes an HTTP header of back-to-origin requests.

key: specifies the name of the header.

value: specifies the value of the header.

l2_oss_key: retrieves your content from private OSS buckets.

private_oss_auth: specifies whether to enable the feature. Valid values: on and off.

range: configures object chunking.

enable: specifies whether to enable the feature. Valid values: on, off, and force.

video_seek: configures video seeking.

enable: specifies whether to enable the feature. This parameter is required. Valid values: on and off.

flv_seek_by_time: specifies whether to enable the Flash Video (FLV) seeking feature based on time. Valid values: on and off.

mp4_seek_start: customizes MP4 video start parameters.

mp4_seek_end: customizes MP4 video end parameters.

flv_seek_start: customizes FLV video start parameters.

flv_seek_end: customizes FLV video end parameters.

ali_remove_args: removes URL parameters.

ali_remove_args: specifies the parameters to be removed. The remaining parameters are used as the URL parameters in the hashkey. Separate multiple parameters with spaces. The ali_remove_args parameter is required.

keep_oss_args: specifies whether to reserve all the parameters during the back-to-origin process. Valid values: on and off. Specify a value of on to reserve all the parameters. Specify a value of off to reserve only the parameters in the hashkey.

https_tls_version: specifies the version of the Transport Layer Security (TLS) protocol.

tls10: specifies whether to enable TLS 1.0. Valid values: on and off. Default value: on.

tls11: specifies whether to enable TLS 1.1. Valid values: on and off. Default value: on.

tls12: specifies whether to enable TLS 1.2. Valid values: on and off. Default value: on.

tls13: specifies whether to enable TLS 1.3. Valid values: on and off. Default value: off.

HSTS: configures HTTP Strict Transport Security (HSTS).

enabled: specifies whether to enable HSTS. This parameter is required. Valid values: on and off. Default value: off.

https_hsts_max_age: specifies the validity period of the HSTS policy. This parameter is required. Unit: second. We recommend that you set the value to 5184000. This value equals 60 days.

https_hsts_include_subdomains: specifies whether the HSTS header contains the includeSubDomains parameter. Valid values: on and off. Use caution if you need to enable this feature. Make sure that HTTPS is enabled for all the subdomains of the name of the accelerated domain. Otherwise, the subdomains become inaccessible after they are redirected to HTTPS.

filetype_force_ttl_code: specifies an expiration rule for file status codes.

file_type: specifies the file type. This parameter is required. You can specify one or more file types and separate them with commas (,). Example: txt,jpg.

code_string: specifies the status codes. This parameter is required. Separate multiple status codes with commas (,). Example: 302=0,301=0,4xx=2.

path_force_ttl_code: specifies an expiration rule for directory status codes.

path: specifies the directory. This parameter is required. It must start with a forward slash (/). Example: /image.

code_string: specifies the status codes. This parameter is required. Separate multiple status codes with commas (,). Example: 302=0,301=0,4xx=2.

gzip: configures HTML optimization.

enable: specifies whether to enable the feature. This parameter is required. Valid values: on and off.

tesla: configures page optimization to accelerate accesses.

enable: specifies whether to enable the feature. This parameter is required. Valid values: on and off.

https_origin_sni: specifies an origin Server Name Indication (SNI).

enable: specifies whether to enable the origin SNI. This parameter is required. Valid values: on and off.

https_origin_sni: specifies the origin SNI. This parameter is required.

limit_rate: configures traffic throttling for individual requests.

ali_limit_rate: specifies the maximum amount of data that can be transferred per second after traffic throttling is triggered, such as 200 KB or 1 MB. This parameter is required. The default unit is byte/s.

ali_limit_rate_after: specifies the amount of data that can be sent before traffic throttling is triggered. The default unit is byte/s.

traffic_limit_arg: specifies the name of the URL parameter based on which traffic throttling is triggered. Example: rate.

traffic_limit_unit: specifies the unit for traffic throttling. Valid values: k, m, and g. For example, when the ali_limit_rate_after parameter is set to 1, the maximum data transfer rate is 1 MB/s, 1 KB/s, or 1 GB/s.

ali_limit_start_hour: specifies the start time of traffic throttling. Valid values: 0 to 24. Default value: 0. This value must be smaller than the value of the end time.

ali_limit_end_hour: specifies the end time of traffic throttling. Valid values: 0 to 24. Default value: 0. This value must be greater than the value of the start time.

brotli: configures Brotli compression.

enable: specifies whether to enable the feature. This parameter is required. Valid values: on and off.

brotli_level: specifies the compression level. Valid values: 1 to 11.

ali_ua: configures access control based on the User-Agent header.

ua: specifies the User-Agent header.

type: specifies the type of the user agent list. Valid values: black and white.

set_l2_req_header: modifies the custom header of requests that are sent to L2 nodes.

key: specifies the name of the header.

value: specifies the content of the header. Enter null if you need to delete the header.

host_redirect: configures URL rewrite.

regex: specifies the URL to be rewritten, such as ^/$.

replacement: specifies the new URL, such as /go/act/sale/tbzlsy.php.

flag: specifies an action. Valid values: redirect and break.

forward_timeout: specifies the time-out period for back-to-origin requests.

forward_timeout: specifies the time-out period in seconds. In most cases, specify a value that is greater than 100.

ali_video_split: configures audio extraction.

enable: specifies whether to enable the feature. Valid values: on and off.

ipv6: configures IPv6.

switch: specifies whether to enable IPv6. This parameter is required. Valid values: on and off. If you need to disable IPv6, clear the check box. Deleting the setting does not disable IPv6.

region: specifies the region where you want to enable IPv6. You can enter an asterisk (*) to specify all regions.

back_to_origin_argument_rewrite: rewrites parameters in back-to-origin requests.

Rule priorities: Add > Delete > Reserve > Modify. Separate multiple parameters with spaces.

delete_argument: specifies parameters to be deleted.

save_argument: specifies parameters to be reserved. Only the specified parameters are reserved. The Reserve, Add, and Delete rules take effect at the same time.

ignore_all_argument: specifies whether to delete all the parameters in back-to-origin requests. Valid values: on and off. Parameters added by the Add action are reserved even if this parameter is set to on.

add_argument: specifies parameters to be added. The Add rule has the highest priority.

modify_argument: specifies parameters to be modified. The Modify rule has the lowest priority. Parameters specified in the Delete rule are not reserved.

back_to_origin_url_rewrite: rewrites origin URLs.

source_url: specifies the URL to be rewritten. This parameter is required.

target_url: specifies the new URL to which the source URL is rewritten. This parameter is required.

flag: specifies an action. Valid values: null, break, and enhance_break. Null: continues to apply subsequent rewrite rules after the current rule is applied. break: stops to apply subsequent rewrite rules after the current rule is applied. enhance_break: applies the current rewrite rule to the URL and its parameters, and then stops to apply subsequent rules. This action is also effective on FLV streaming.

edge_function: specifies EdgeScript.

rule: specifies a domain-specific language (DSL) script. This parameter is required.

pri: specifies the priority of the DSL script. This parameter is required.

enable: specifies whether to enable the script. This parameter is required. Valid values: on and off.

name: specifies the name of the script.

pos: specifies whether to execute the script at the start or end of the request processing pipeline. For the accelerated domains of Dynamic Route for CDN (DCDN), only a value of head is supported.

brk: After the script is matched, the subsequent scripts at the specified position are skipped.

option: an extension that is used to perform response header debugging.

grammar: an extension that is used to specify the scripting language. Valid values: es2 and js. You can also leave this parameter empty.

jsmode: an extension that is used to manage the domain name whitelist in JavaScript. Valid values: redirect and bypass.

Response parameters

Parameter Type Example Description
RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

Examples

Sample requests

http://dcdn.aliyuncs.com?Action=BatchSetDcdnDomainConfigs
&DomainName=example.com
&Functions=[{"functionArgs":[{"argName":"domain_name","argValue":"example.com"}],"functionName":"set_req_host_header"}]
&<Common request parameters>

Sample success responses

XML format

<BatchSetDcdnDomainConfigsResponse>
      <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
</BatchSetDcdnDomainConfigsResponse>

JSON format

{
    "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368"
}

Error codes

HttpCode Error code Error message Description
400 InvalidFunctions.Malformed The specified Functions is invalid. The error message returned because the specified Functions parameter is invalid.
400 InvalidArgValue.Malformed The specified ArgValue is invalid. The error message returned because the specified argValue parameter is invalid.
400 Invalid%s.ValueNotSupported [%s] is not supported. The error message returned because the specified value is not supported.
400 Invalid%s.Malformed The specified ArgValue [%s] is invalid. The error message returned because the specified argValue parameter is invalid.

For a list of error codes, visit the API Error Center.