Configures multiple accelerated domain names at a time.

Note The maximum number of times that each user can call this operation per second is 30.

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 BatchSetCdnDomainConfig

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

DomainNames String Yes example.com

The accelerated domain names. Separate multiple accelerated domain names with commas (,).

Functions String Yes [{"functionArgs":[{"argName":"domain_name","argValue":"api.hellodtworld.com"}],"functionName":"set_req_host_header"}]
The features that you want to configure. Format:
[{"functionArgs":[{"argName":"Parameter key","argValue":"Parameter value"},{"argName":"xx","argValue":"xx"}],"functionName": Feature name"}]

Separate multiple parameters with commas (,).

Some features, such as filetype_based_ttl_set, support multiple configuration records. If you need to update one of the configuration records, specify the ID of the configuration (configId).

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

Note: Specify parameter values in a string.

Feature

Parameter

referer_white_list_set: configures a 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 with an empty referer header are allowed to access CDN resources. Valid values: on and off.

referer_black_list_set: configures 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 with an empty referer header are allowed to access CDN 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: specifies the file type. You can specify one or more file types. Separate multiple file types with commas (,). Example: TXT,JPG.

weight: the weight of the directory in the cache. Maximum value: 99. Minimum value: 1. A greater value indicates a higher priority.

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 (/).

weight: the weight of the directory expiration. Maximum value: 99. Minimum value: 1. A greater value indicates a higher priority.

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 blacklist.

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

ip_allow_list_set: configures an IP 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 which error pages are redirected when the specified error occurs.

set_req_host_header: configures the custom header for requests that are redirected to the origin server.

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: specify a value of on to ignore all parameters. Specify a value of off to reserve parameters. 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: specify a value of on to reserve all parameters in requests that are redirected to the origin server. Specify a value of off to use the hashkey_args setting.

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 authentication type A. Specify a value of type_b to use authentication type B. Specify a value of type_c to use authentication type C.

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

ali_auth_delta: customizes the buffer time for authentication.

set_resp_header: sets a response header. To verify the setting, you can check the response in a browser.

key: specifies the response header. This parameter is required.

value: specifies the value of the response header. Enter null if you want to delete the header. This parameter is required.

header_operation_type: specifies the action to be performed on a request header. Valid values: add, delete, modify, and rewrite. add: adds a request header. delete: deletes a request header. modify: modifies a request header. rewrite: rewrites a request header.

duplicate: specifies whether duplicate request headers are allowed. Valid values: on and off.

header_source: searches for the source of the request header.

header_destination: replaces the request header.

match_all: specifies whether to match all queries.

https_force: redirects visitors from HTTP URLs to HTTPS URLs.

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

https_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 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.

set_req_header: customizes an HTTP header for requests that are redirected to the origin server.

key: the name of the header.

value: specifies the value of the header.

l2_oss_key: retrieves content from private OSS buckets.

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

range: configures object chunking to retrieve content from the origin based on HTTP range requests.

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. Valid values: on and off. This parameter is required.

flv_seek_by_time: specifies whether to enable Flash Video (FLV) seeking by 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: ignores URL parameters.

ali_remove_args: specifies the parameters to be ignored. The remaining parameters are used as the URL parameters in the hashkey. Separate multiple parameters with space characters. This parameter is required.

keep_oss_args: specifies whether to reserve all parameters. Valid values: on and 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: configures the TLS protocol.

tls10: configures TLS 1.0. Valid values: on and off. Default value: on.

tls11: configures TLS 1.1. Valid values: on and off. Default value: on.

tls12: configures TLS 1.2. Valid values: on and off. Default value: on.

tls13: configures TLS 1.3. Valid values: on and off. Default value: off.

HSTS: configures HSTS.

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

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

https_hsts_include_subdomains: specifies whether the HSTS header contains the includeSubDomains parameter. Valid values: on and off. Proceed with caution. Make sure that HTTPS is enabled for all subdomains of the accelerated domain name. Otherwise, the subdomains will 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: specifies the file types. Separate multiple file types with commas (,). Example: txt,jpg. This parameter is required.

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

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

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

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

gzip: configures the intelligent compression feature.

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

tesla: configures HTML optimization.

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

https_origin_sni: configures an origin SNI.

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

https_origin_sni: required. It specifies the origin SNI.

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 KM or 1 MB. The default unit is byte/s. This parameter is required.

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 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: 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: 0. This value must be greater than the value of the start time.

brotli: configures Brotli compression.

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

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

ali_ua: configures user-agent-based access control.

ua: specifies user agents.

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

set_l2_req_header: customizes the header of requests 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, for example, ^/$.

replacement: specifies the target URL, for example, /go/act/sale/tbzlsy.php.

flag: redirect or break.

forward_timeout: configures the timeout period for requests that are redirected to the origin server.

forward_timeout: specifies the timeout period in seconds. In most cases, specify a value that is 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: specifies whether to enable IPv6. on: enables IPv6. off: disables IPv6. This parameter is required.

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

ali_video_preview: configures the video preview feature.

enable: specifies whether to enable this feature. Valid values: on and off. The video preview feature supports the TS and MP3 formats. For FLV and MP4 video files, visitors can seek videos by advancing and rewinding videos. This parameter is required.

ali_video_preview_argument: specifies the length of the videos that can be previewed by visitors. The parameter value must be measured in seconds. This parameter is required.

default_ttl_code: configures a TTL rule for HTTP status codes.

default_ttl_code: specifies the default TTL for status codes. Unit: seconds. Example: 4xx=3, 200=3600, and 5xx=1. Separate multiple status codes with commas (,). This parameter is required.

back_to_origin_argument_rewrite: configures origin parameter rewrite.

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

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 parameters in requests that are redirected to the origin server. Valid values: on and off. However, parameters added by the Add action are reserved.

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

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

back_to_origin_url_rewrite: configures origin URL rewrite.

source_url: required. It specifies the URL to be rewritten.

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

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

edge_function: configures EdgeScript functions.

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

pri: required. It specifies the priority of the DSL script.

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

name: the name of the script.

pos: specifies whether to execute the script at the start or end of the request processing pipeline.

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

option: an extension used to perform response header debugging.

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

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

follow_302: configures 302 redirects.

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

max_tries: specifies the maximum number of 302 redirects that can be performed. You can set the value to n+1. The value of n cannot be greater than 5. The default value is 3. In this case, the maximum number of redirects is three times (2+1=3).

aws_s3_bucket: specifies the Amazon Web Services (AWS) Simple Storage Service (S3) buckets that require authentication.

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

bucketname: specifies the names of the AWS S3 buckets.

accesskey: specifies the AWS access key ID. This parameter is required.

secretkey: specifies the AWS secret access key. This parameter is required.

region: specifies the Region where the AWS S3 bucket is deployed.

origin_request_header: configures HTTP request headers.

header_operation_type: specifies the action to be performed on the request header. Valid values: add, delete, modify, and rewrite. The Add action adds a request header. The Delete action deletes a request header. The Modify action modifies a request header. The Rewrite action rewrites a request header. This parameter is required.

header_name: specifies the name of the request header. This parameter is required.

header_value: specifies the value of the request header. This parameter is required.

duplicate: specifies whether to allow duplicate request headers. Valid values: on and off.

header_source: searches for the source of the response header.

header_destination: replaces the response header.

match_all: specifies whether to match all queries. Valid values: on and off.

origin_response_header: configures HTTP response headers.

header_operation_type: specifies the action to be performed on the response header. Valid values: add, delete, modify, and rewrite. The Add action adds a response header. The Delete action deletes a response header. The Modify action modifies a response header. The Rewrite header rewrites a response header. This parameter is required.

header_name: specifies the name of the response header. This parameter is required.

header_value: specifies the value of the response header.

duplicate: specifies whether to allow duplicate response headers. Valid values: on and off.

header_source: searches for the source of the response header.

header_destination: replaces the response header.

match_all: specifies whether to match all queries. Valid values: on and off.

Response parameters

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

The ID of the request.

Examples

Sample requests

http(s)://cdn.aliyuncs.com/?Action=BatchSetCdnDomainConfig
&DomainNames=example.com
&Functions=[{"functionArgs":[{"argName":"domain_name","argValue":"api.hellodtworld.com"}],"functionName":"set_req_host_header"}]
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

HttpCode Error code Error message Description
400 InvalidFunctions.Malformed The specified Functions is incorrectly formatted. The error message returned because the format of the configuration is invalid.
400 InvalidHeaderKey.ValueNotSupported The specified value of parameter HeaderKey is not supported. The error message returned because the specified HTTP request header field is invalid. Valid values of the Key parameter: 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, Access-Control-Expose-Headers, and Access-Control-Allow-Credentials.
400 NoPermission.SLR The current user does not have permission to create servicelinkedrole. Please contact the Alibaba Cloud account or administrator to authorize AliyunCDNFullAccess or custom policy:Service Name:cdn-ddos.cdn.aliyuncs.com,Role: AliyunServiceRoleForCDNAccessingDDoS,Permission: ram: CreateServiceLinkedRole The error message returned because no permission policy is attached to the service-linked role. You must contact the owner of the Alibaba Cloud account or administrator to grant the AliyunCDNFullAccess permission or attach a custom permission policy to the service-linked role. Information about custom permission policies:Service name: cdn-ddos.cdn.aliyuncs.com.Name of the service linked role: AliyunServiceRoleForCDNAccessingDDoS.Required permission: ram:CreateServiceLinkedRole.

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