Configures features for one or more domain names.

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 accelerated domain names. Separate multiple domain names with commas (,).

Functions String Yes [{"functionArgs":[{"argName":"domain_name","argValue":"example.com"}],"functionName":"set_req_host_header"}]

The list of features. Specify this parameter in the following format:

[{"functionArgs":[{"argName":"parameter name","argValue":"parameter value"}],"functionName":"feature name"}]

Each value of the Functions parameter must be a string.

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

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

The following table describes the supported features.

Feature

Parameter

referer_white_list_set: configures the referer whitelist for hotlink protection.

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

allow_empty: specifies whether requests with an empty referer header are allowed to access Dynamic Route for CDN (DCDN) resources. Valid values: on and off.

referer_black_list_set: configures a referer blacklist for hotlink protection.

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

allow_empty: specifies whether requests with an empty referer header are allowed to access DCDN resources. Valid values: on and off.

filetype_based_ttl_set: sets an expiration rule for specific file types.

ttl: the time period after which the cached data expires. Unit: seconds.

file_type: the file type. Separate multiple file types with commas (,). Example: TXT,JPG.

path_based_ttl_set: sets an expiration rule for a specific directory.

ttl: the time period after which the cached data expires. Unit: seconds.

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

oss_auth: configures authentication for requests destined for an Object Storage Service (OSS) bucket.

oss_bucket_id: the endpoint of the OSS bucket.

ip_black_list_set: configures an 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: configures an IP address whitelist.

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

ip_white_list_set: configures an IP address whitelist for rate limiting.

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 which error pages are redirected 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: A value of on indicates that all parameters are ignored. A value of off indicates that all parameters are reserved. The hashkey_args setting has a higher priority. Even if you have set this setting to on, the parameters specified in hashkey_args are reserved.

keep_oss_args: A value of on indicates that all the 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 Cloud authentication.

auth_type: specifies the authentication type. Specify a value of no_auth to disable authentication. Specify a value of type_a to use type A authentication. Specify a value of type_b to use type B authentication. Specify a value of type_c to use type C authentication.

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

ali_auth_delta: customizes the buffer time for authentication.

set_resp_header: specifies a response header. To verify the setting, you can check the response messages in your 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 want to delete the header.

https_force: redirects visitors from HTTP URLs to HTTPS URLs.

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

http_force: redirects visitors from HTTPS URLs to HTTP URLs.

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

https_option: configures 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 content moderation.

enable: specifies whether to enable content moderation. Valid values: on and off.

tmd_signature: specifies a custom rule for rate limiting.

name: specifies the name of the rule. It must be unique within the domain name.

path: You can specify duplicate URI paths. However, you must verify their validity.

pathType: specifies the match mode. Valid values: 0 and 1. A value of 0 indicates a prefix match. A value of 1 indicates an exact match.

interval: the interval at which data is monitored. Unit: seconds. The interval must be greater than or equal to 10 seconds.

count: specifies the number of visits from an IP address.

action: the operation to be performed after specified conditions are met. Valid values: 0 and 1. A value of 0 indicates blocking. A value of 1 indicates bot detection.

ttl: specifies the time period during which access is blocked. Unit: seconds.

dynamic: configures the DCDN service.

enable: required. This parameter specifies whether to enable the feature. 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 the 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.

dynamic_route_adapt_cache: specifies whether to enable adaptive caching. 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 retrieve your content from private OSS buckets. 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: required. This parameter specifies whether to enable the feature. 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.

websocket: configures the WebSocket protocol.

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

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

heartbeat: specifies the heartbeat interval. Unit: seconds. Valid values: 1 to 300. Default value: 60.

ali_remove_args: ignores URL parameters.

ali_remove_args: required. This setting specifies the parameters to be removed. The remaining parameters are used as the URL parameters in the hashkey_args. Separate multiple parameters with spaces.

keep_oss_args: on or off. A value of on indicates that all parameters are reserved during the back-to-origin process. A value of off indicates that only the parameters in the hashkey_args are reserved.

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: required. This parameter specifies whether to enable the feature. Valid values: on and off. Default value: off.

https_hsts_max_age: required. This parameter specifies the validity period of the HSTS policy. Unit: milliseconds. We recommend that you set the value to 5184000000 milliseconds. 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 want to enable this feature. Make sure that HTTPS is enabled for all subdomains of this accelerated domain name. Otherwise, the subdomains become inaccessible after they are redirected to HTTPS URLs.

filetype_force_ttl_code: configures a time-to-live (TTL) rule for HTTP status codes based on file types.

file_type: required. This parameter specifies the file type. Separate multiple file types with commas (,). Example: TXT,JPG.

code_string: required. This parameter specifies TTL values for HTTP status codes. Separate multiple TTL settings with commas (,). Example: 302=0,301=0,4xx=2.

path_force_ttl_code: configures a TTL rule for HTTP status codes based on directories.

path: required. This parameter must start with a forward slash (/). Example: /image.

code_string: required. This parameter specifies TTL values for HTTP status codes. Separate multiple TTL settings with commas (,). Example: 302=0,301=0,4xx=2.

gzip: optimizes pages by using GNU zip (Gzip) compression.

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

tesla: configures page optimization to speed up page loading.

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

protogw: configures IP Application Accelerator.

realip: required. This parameter specifies the transparent proxy mode for the origin server to obtain the real IP addresses of the clients. Valid values: off, toa, and pp.

port: required. This parameter specifies the service port.

quic: configures basic parameters of Quick UDP Internet Connections (QUIC).

quic_enable: specifies whether to enable QUIC. Valid values: on and off.

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

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

https_origin_sni: required. This parameter specifies an origin Server Name Indication (SNI) value.

limit_rate: configures traffic throttling for individual requests.

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

ali_limit_rate_after: specifies the amount of data that can be sent before traffic throttling is triggered. Unit: bytes.

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 can be 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 that of the start time.

brotli: configures Brotli compression.

enable: required. This parameter specifies whether to enable the feature. 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 want to delete the header.

host_redirect: configures URL rewrite.

regex: specifies the URL to be rewritten. Example: ^/$.

replacement: specifies the new URL. Example: /go/act/sale/tbzlsy.php.

flag: redirect or break.

forward_timeout: configures the timeout period for back-to-origin requests.

forward_timeout: The unit is second. In most cases, specify a value no greater than 100.

ali_video_split: configures audio extraction.

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

ipv6: configures IPv6.

switch: required. This parameter specifies whether to enable the feature. Valid values: on and off. If you want to disable IPv6, clear the corresponding check box in the console. You cannot disable IPv6 by deleting this setting.

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

default_ttl_code: configures a TTL rule for HTTP status codes.

default_ttl_code: required. This parameter specifies the default TTL values for HTTP status codes. Unit: seconds. Separate multiple TTL settings with commas (,). Example: 4xx=3,200=3600,5xx=1. Note: This feature is used to set cache durations for the files in DCDN based on HTTP status codes. If the response headers from an origin server contain the Expires and Cache-Control headers, the configuration of the origin server takes precedence.

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

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

delete_argument: specifies the parameters to be deleted.

save_argument: specifies the 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 the parameters to be added. The Add rule has the highest priority.

modify_argument: specifies the 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: creates a URL rewrite rule for back-to-origin requests.

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

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

flag: specifies an action. Valid values: break and enhance_break. You can also leave this parameter empty. Empty value: continues to apply subsequent rewrite rules after the current rule is applied. break: stops applying 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 applying subsequent rules. This action is also effective on FLV streaming.

edge_function: configures EdgeScript.

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

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

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

name: specifies the name of the script.

pos: specifies the position to run the script. For accelerated domain names of DCDN, only the value of head is supported. The value of foot is not 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.

origin_certificate_verification: verifies origin certificates.

enable: required. This parameter specifies whether to enable the feature. Valid values: on and off. A value of on indicates that origin certificate verification is enabled and a value of off indicates that origin certificate verification is disabled.

common_name_whitelist: specifies the common names to be added to the whitelist. Certificates whose common names are in the whitelist can pass the verification.

Response parameters

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

The ID of the request.

Examples

Sample requests

http(s)://dcdn.aliyuncs.com/? Action=BatchSetDcdnDomainConfigs
&DomainNames=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 value of the Functions parameter is invalid. Specify a valid value.
400 InvalidArgValue.Malformed The specified ArgValue is invalid. The error message returned because the specified value of the ArgValue parameter is invalid. Specify a valid value.
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 value of the ArgValue parameter is invalid. Specify a valid value.
400 MissingParameter You must specify ArgValue. The error message returned because the required parameters are not set.

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