You can call the BatchSetDcdnDomainConfigs to configure features for multiple domain names at a time. This topic describes the features that you can call this operation to configure and parameters that you need to specify when you call this operation.
The features described in this topic can be referenced when you call the following API operations: BatchSetDcdnDomainConfigs, DescribeDcdnDomainConfigs, BatchDeleteDcdnDomainConfigs, and DescribeDcdnUserDomainsByFunc.
You can call BatchSetDcdnDomainConfigs to configure features for multiple domain names. If the operation succeeds, unique configuration IDs (ConfigId) are generated. You can use the configuration IDs to update or delete the configurations of the features. For more information, see Usage notes on ConfigId.
Basic information
dynamic
Feature description: configures static and dynamic acceleration rules. For more information, see Overview.
Feature ID (FunctionID/FuncId): 46.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable static and dynamic acceleration. Valid values:
on
off
on
static_route_type
String
No
The file name extension of a static file.
.txt
static_route_url
String
No
The URI of the static file.
/domain/detail/log.txt
static_route_path
String
No
The path of the static file.
NoteYou can use the asterisk (*) and question mark (?) wildcard characters for a fuzzy search of the path of the static file. The asterisk (*) specifies zero, one, or more characters. The question mark (?) specifies one character.
/abc/test/*
dynamic_route_origin
String
No
The origin protocol policy used to retrieve dynamic content. Valid values:
http: Dynamic Content Delivery Network (DCDN) redirects requests to the origin server over HTTP.
https: DCDN redirects requests to the origin server over HTTPS.
follow: When a client uses HTTP or HTTPS to request resources, DCDN redirects the request to the origin server over the protocol that is used by the client.
follow-port: When a client uses HTTP or HTTPS to request resources, DCDN redirects the request to the origin server over the protocol that is used by the origin server port.
NoteDefault value: follow.
https
dynamic_route_round_robin
String
No
Specifies whether to enable load balancing. Default value: off. Valid values:
on
off
off
partition_back_to_origin
String
No
Specifies whether to enable separated origin fetch for the Chinese mainland and outside the Chinese mainland. Default value: off. Valid values:
on
off
off
dynamic_route_adapt_cache
String
No
Specifies whether to enable adaptive caching. Default value: off. Valid values:
on
off
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "static_route_type", "argValue": ".txt" }, { "argName": "static_route_url", "argValue": "/domain/detail/log.txt" },{ "argName": "static_route_path", "argValue": "/abc/test/*" }, { "argName": "dynamic_route_origin", "argValue": "https" }, { "argName": "dynamic_route_round_robin", "argValue": "off" }, { "argName": "dynamic_route_adapt_cache", "argValue": "off" }], "functionName": "dynamic" }], "DomainNames": "example.com" }
ipv6
Feature description: configures IPv6. For more information, see Enable IPv6.
Feature ID (FunctionID/FuncId): 194.
Request parameters
Parameter
Type
Required
Description
Example
switch
String
Yes
Specifies whether to enable IPv6. Valid values:
on
off
on
region
String
Yes
The region where you want to enable IPv6.
NoteYou can enter an asterisk (*) to specify all regions. If you want to enable IPv6 in a specified region, submit a ticket.
If you do not set the region parameter, IPv6 is enabled in all regions.
*
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "switch", "argValue": "on" }, { "argName": "region", "argValue": "*" }], "functionName": "ipv6" }], "DomainNames": "example.com" }
Origin fetch settings
set_req_host_header
Feature description: configures an origin host. For more information, see Configure an origin host.
Feature ID (FunctionID/FuncId): 18.
Request parameters
Parameter
Type
Required
Description
Example
domain_name
String
Yes
The origin host.
example.com
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "domain_name", "argValue": "example.com" }], "functionName": "set_req_host_header" }], "DomainNames": "example.com" }
forward_scheme
Feature description: configures the origin protocol policy. For more information, see Configure the static origin protocol policy.
Feature ID (FunctionID/FuncId): 47.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable the origin protocol policy. Valid values:
on
off
on
scheme_origin
String
No
The protocol for origin fetch. Valid values:
http: DCDN redirects requests to the origin server over HTTP.
https: DCDN redirects requests to the origin server over HTTPS.
follow: When a client uses HTTP or HTTPS to request resources, DCDN redirects the request to the origin server over the protocol that is used by the client.
NoteDefault value: follow.
follow
scheme_origin_port
String
No
The custom origin port. This parameter needs to be used together with the scheme_origin parameter. Valid values:
If scheme_origin is set to http, you only need to configure an origin HTTP port, such as 8080.
If scheme_origin is set to https, you only need to configure an origin HTTPS port, such as 4433.
If scheme_origin is set to follow, you need to configure origin HTTP and HTTPS ports. Separate the ports with colons (:). Example: 8080:4433.
8080:4433
Example 1: DCDN redirects requests to the origin server over the protocol that is used by the client. The origin port is the default port of the protocol, which is 80 for HTTP and 443 for HTTPS.
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "scheme_origin", "argValue": "follow" }], "functionName": "forward_scheme" }], "DomainNames": "example.com" }
Example 2: DCDN redirects requests to the origin server over the protocol that is used by the client. The origin port is a custom port, which is 8080 for HTTP and 4433 for HTTPS.
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "scheme_origin", "argValue": "follow" }, { "argName": "scheme_origin_port", "argValue": "8080:4433" }], "functionName": "forward_scheme" }], "DomainNames": "example.com" }
l2_oss_key
Feature description: configures access control on private Object Storage Service (OSS) buckets. For more information, see Configure private bucket origin.
Feature ID (FunctionID/FuncId): 85.
Request parameters
Parameter
Type
Required
Description
Example
private_oss_auth
String
Yes
Specifies whether to enable access to private OSS buckets. Valid values:
on
off
After you enable this feature, the system automatically configures an STS token. However, DCDN can only access to private OSS buckets in the same Alibaba Cloud account. For more information about STS tokens, see What is STS?
on
perm_private_oss_tbl
String
No
The permanent security token in the format of
access_id=123 access_secret=123abc
(separated by a space).After you configure a permanent security token, DCDN can access private OSS buckets in the same Alibaba Cloud account or a different Alibaba Cloud account. For more information about permanent security tokens, see Create an AccessKey pair.
access_id=123 access_secret=123abc
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "private_oss_auth", "argValue": "on" },{ "argName": "perm_private_oss_tbl", "argValue": "access_id=123 access_secret=123abc" }], "functionName": "l2_oss_key" }], "DomainNames": "example.com" }
oss_key_list
Feature description: configures one or more rules that define the security tokens used to access different private OSS buckets.
Feature ID (FunctionID/FuncId): 183.
Request parameters
Parameter
Type
Required
Description
Example
host
String
Yes
The URL of the private OSS bucket.
example.oss-cn-hangzhou.aliyuncs.com
key
String
Yes
The permanent security token in the format of
access_id=123 access_secret=123abc
(separated by a space).After you configure a permanent security token, DCDN can access private OSS buckets in the same Alibaba Cloud account or a different Alibaba Cloud account. For more information about permanent security tokens, see Create an AccessKey pair.
access_id=123 access_secret=123abc
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "host", "argValue": "example.oss-cn-hangzhou.aliyuncs.com" },{ "argName": "key", "argValue": "access_id=123 access_secret=123abc" }], "functionName": "oss_key_list" }], "DomainNames": "example.com" }
https_origin_sni
Feature description: configures origin Server Name Indication (SNI). For more information, see Configure origin SNI.
Feature ID (FunctionID/FuncId): 114.
Request parameters
Parameter
Type
Required
Description
Example
enabled
String
Yes
Specifies whether to enable origin SNI. Valid values:
on
off
on
https_origin_sni
String
Yes
The SNI information that is carried in back-to-origin requests. The SNI information specifies the address of the origin server.
origin.example.com
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "https_origin_sni", "argValue": "origin.example.com" }, { "argName": "enabled", "argValue": "on" }], "functionName": "https_origin_sni" }], "DomainNames": "example.com" }
forward_timeout
Feature description: configures a request timeout period for origin fetch. For more information, see Configure a timeout period for back-to-origin requests.
Feature ID (FunctionID/FuncId): 124.
Request parameters
Parameter
Type
Required
Description
Example
forward_timeout
Integer
Yes
The timeout period for the request. Unit: seconds.
NoteWe recommend that you set this parameter to less than 100 seconds.
30
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "forward_timeout", "argValue": "30" }], "functionName": "forward_timeout" }], "DomainNames": "example.com" }
advanced_origin
Feature description: configures advanced origin settings. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature conflicts: The advanced origin settings feature conflicts with the conditional origin feature (function: origin_dns_host, feature ID: 212). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 235.
Request parameters
Parameter
Type
Required
Description
Example
variable_type
String
Yes
The type of the variable. Valid values:
header: a request header.
arg: a query string parameter in a request URL.
uri: a path in a request URL.
cookie: a request cookie.
uri
variable
String
Yes
The name of the variable.
NoteIf you set the variable_type parameter to uri, the value of the variable parameter can only be uri.
uri
conditions
String
Yes
The condition. Valid values:
==: equals.
!=: does not equal.
==
value
String
Yes
The value of the variable.
/image
origin
String
Yes
The domain name of the origin server that is carried in a variable in a user request. Requests that are destined for the domain name are redirected to the specified origin server.
origin.example.com
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "conditions", "argValue": "==" }, { "argName": "variable_type", "argValue": "uri" }, { "argName": "value", "argValue": "/image" }, { "argName": "origin", "argValue": "origin.example.com" }, { "argName": "variable", "argValue": "uri" }], "functionName": "advanced_origin" }], "DomainNames": "example.com", }
follow_302
Feature description: configures 302 redirection. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 219.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable 302 redirection.
on
off
on
max_tries
Integer
No
The maximum number of 302 redirects.
Default value: 2.
Valid values: 1 to 5.
NoteNumber of times for origin fetch - 1 = Number of 302 redirects. The default value of the maximum number of times for origin fetch is 3, and valid values are 2 to 6.
2
retain_args
String
No
Specifies whether to retain request parameters during 302 redirects. Default value: off. Valid values:
on
off
off
retain_header
String
No
Specifies whether to retain request headers during 302 redirects. Default value: off. Valid values:
on
off
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "max_tries", "argValue": 2 }, { "argName": "retain_args", "argValue": "off" }, { "argName": "retain_header", "argValue": "off" }], "functionName": "follow_302" }], "DomainNames": "example.com" }
set_req_header
Feature description: configures a custom origin HTTP header (old). For more information, see Configure a custom origin HTTP header.
Noteset_req_header is version 1. We recommend that you use origin_request_header, which is version 2. origin_request_header supports more headers.
Feature ID (FunctionID/FuncId): 39.
Request parameters
Parameter
Type
Required
Description
Example
key
String
Yes
The name of the header.
Accept-Encoding
value
String
Yes
The value of the header. If you want to delete a header, set the header value to null.
gzip
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "value", "argValue": "gzip" }, { "argName": "key", "argValue": "Accept-Encoding" }], "functionName": "set_req_header" }], "DomainNames": "example.com" }
origin_request_header
Feature description: configures a custom origin HTTP header (new). This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 228.
Request parameters
Parameter
Type
Required
Description
Example
header_operation_type
String
Yes
The operation that you want to perform on the request header. Valid values:
add
delete
modify
rewrite
add
header_name
String
Yes
The name of the request header.
Accept-Encoding
header_value
String
No
The value of the request header. You can specify one or more values for a request header. Separate values with commas (,).
gzip
duplicate
String
No
Specifies whether to allow duplicate request headers. If you set the header_operation_type parameter to add, you need to specify this parameter. Valid values:
on
off
off
header_source
String
No
The header value that you want to replace. If you set the header_operation_type parameter to rewrite, you need to specify this parameter. Regular expressions are supported.
value1
header_destination
String
No
The header value that is used to replace the original header value. If you set the header_operation_type parameter to rewrite, you need to specify this parameter.
value123
match_all
String
No
The match mode. If you set the header_operation_type parameter to rewrite, you need to specify a match mode. Valid values:
on: All header values that match the search condition are replaced.
off: Only the first value that matches the search condition is replaced.
off
Example: Add an origin request header to requests that are destined for
example.com
. Set the header name to Accept-Encoding, and the header value to gzip.{ "Functions": [{ "functionArgs": [{ "argName": "header_operation_type", "argValue": "add" }, { "argName": "header_name", "argValue": "Accept-Encoding" }, { "argName": "header_value", "argValue": "gzip" }, { "argName": "duplicate", "argValue": "off" }], "functionName": "origin_request_header" }], "DomainNames": "example.com" }
origin_response_header
Feature description: configures an origin HTTP response header. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 229.
Request parameters
Parameter
Type
Required
Description
Example
header_operation_type
String
Yes
The operation that you want to perform on the response header. Valid values:
add
delete
modify
rewrite
add
header_name
String
Yes
The name of the response header.
Cache-Control
header_value
String
No
The value of the response header. You can specify multiple values for a response header. Separate the values with commas (,).
no-cache
duplicate
String
No
Specifies whether to allow duplicate response headers. If you set the header_operation_type parameter to add, you need to specify this parameter. Valid values:
on
off
off
header_source
String
No
The header value that you want to replace. If you set the header_operation_type parameter to rewrite, you need to specify this parameter. Regular expressions are supported.
value1
header_destination
String
No
The header value that is used to replace the original header value. If you set the header_operation_type parameter to rewrite, you need to specify this parameter.
value123
match_all
String
No
The match mode. If you set the header_operation_type parameter to rewrite, you need to specify a match mode. Valid values:
on: All header values that match the search condition are replaced.
off: Only the first value that matches the search condition is replaced.
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "header_operation_type", "argValue": "add" }, { "argName": "header_name", "argValue": "Cache-Control" }, { "argName": "header_value", "argValue": "no-cache" }, { "argName": "duplicate", "argValue": "off" }], "functionName": "origin_response_header" }], "DomainNames": "example.com" }
back_to_origin_url_rewrite
Feature description: rewrites URIs in back-to-origin requests. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 225.
Request parameters
Parameter
Type
Required
Description
Example
source_url
String
Yes
The URI that you want to rewrite.
^/hello$
target_url
String
Yes
The final URI.
/hello/test
flag
String
No
The rewrite flag. Valid values:
None: If the current rule is matched, the system continues matching the URI against other rules.
break: If the current rule is matched, the system skips other rules.
enhance_break: This flag is similar to break, except that this flag writes the URL parameters and takes effect for Flash Video (FLV) live streaming.
break
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "flag", "argValue": "break" }, { "argName": "source_url", "argValue": "^/hello$" }, { "argName": "target_url", "argValue": "/hello/test" }], "functionName": "back_to_origin_url_rewrite" }], "DomainNames": "example.com", }
back_to_origin_argument_rewrite
Feature description: rewrites parameters in back-to-origin requests. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
NoteAfter you enable this feature, DCDN rewrites query strings in origin URLs. You can configure one or more rewrite rules. Rewrite rules take effect in the following order: Add > Delete > Reserve Only > Modify. If you configure multiple rewrite rules for the same parameter, only the rewrite rule that has the highest priority takes effect.
Feature ID (FunctionID/FuncId): 224.
Request parameters
Parameter
Type
Required
Description
Example
delete_argument
String
No
The parameters that you want to delete. Separate parameters with spaces.
code1
save_argument
String
No
The parameters that you want to retain. Separate parameters with spaces. Only the specified parameters are retained. The Add and Delete rules remain effective.
None
ignore_all_argument
String
No
Specifies whether to ignore all parameters. Valid values:
on: ignores all parameters. Only the Add rule takes effect.
off (default): does not ignore all parameters. The Retain, Add, and Delete rules remain effective.
on
add_argument
String
No
The parameters that you want to add. Separate multiple parameters with spaces. The Add rule has the highest priority.
value=123
modify_argument
String
No
The parameters that you want to modify. Separate multiple parameters with spaces. The Modify rule has the lowest priority.
value=321
enable
String
Yes
Specifies whether to enable parameter rewrite.
on
off
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "delete_argument", "argValue": "" }, { "argName": "save_argument", "argValue": "" }, { "argName": "add_argument", "argValue": "" }, { "argName": "modify_argument", "argValue": "" }, { "argName": "ignore_all_argument", "argValue": "on" }, { "argName": "enable", "argValue": "on" }], "functionName": "back_to_origin_argument_rewrite" }], "DomainNames": "example.com" }
aws_s3_bucket
Feature description: configures Amazon Simple Storage Service (S3) authentication. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 186.
Request parameters
Parameter
Type
Required
Description
Example
enabled
String
Yes
Specifies whether to enable Amazon S3 authentication.
I2: enables Amazon S3 authentication.
off: disables Amazon S3 authentication.
l2
bucketname
String
No
The name of the Amazon S3 bucket.
/
accesskey
String
Yes
The AWS access key.
123456789
secretkey
String
Yes
The AWS secret key.
12345678
region
String
Yes
The region of the Amazon S3 bucket.
us-east-2
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enabled", "argValue": "l2" }, { "argName": "accesskey", "argValue": "123456789" }, { "argName": "secretkey", "argValue": "123456789" }, { "argName": "region", "argValue": "us-east-2" }], "functionName": "aws_s3_bucket" }], "DomainNames": "example.com" }
origin_certificate_verification
Feature description: configures an SNI whitelist. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 223.
Request parameters
Parameter
Type
Required
Description
Example
enabled
String
Yes
Specifies whether to enable the SNI whitelist. Valid values:
on
off
on
common_name_whitelist
String
No
The domain names that you want to add to the SNI whitelist. Separate multiple domain names with commas (,). The domain names in the whitelist are considered authenticated.
example.com
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "common_name_whitelist", "argValue": "example.com" }], "functionName": "origin_certificate_verification" }], "DomainNames": "example.com" }
origin_dns_host
Feature description: configures a conditional origin. You can use this feature in conjunction with the rules engine feature (function: condition, feature ID: 250) to retrieve content from a specified origin server based on the paths, URL parameters, or headers in user requests. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Prerequisites: At least one rule is created by using the rules engine feature before you configure a conditional origin. When you configure a conditional origin, make sure that a rule is associated with the conditional origin. For more information, see Rules engine. If you do not associate a rule with the conditional origin, all back-to-origin traffic is directed to the origin server. This way, conditional origin fetch is not implemented.
Feature conflicts: The conditional origin feature conflicts with the advanced origin settings feature (function: advanced_origin, feature ID: 235). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 212.
Request parameters
Parameter
Type
Required
Description
Example
ali_origin_dns_host
String
Yes
The domain name for origin fetch.
example.com
Example: Set parentid to the value of configid that is generated when you create a rule by using the rules engine feature (function: condition, feature ID: 250) to reference the rule. If a request matches the rule, the request is redirected to the origin server that is specified by the rule.
{ "Functions": [{ "functionArgs": [{ "argName": "ali_origin_dns_host", "argValue": "example.com" }], "functionName": "origin_dns_host", "parentId":30119730104**** }], "DomainNames": "example.com" }
origin_host
Feature description: configures the origin host for each origin. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 242.
Request parameters
Parameter
Type
Required
Description
Example
origin
String
Yes
The address of the origin server. If you do not specify an origin address, the origin parameter is automatically set to all.
example.com
host
String
Yes
The host. You can set the host parameter to
ali_follow_origin
to use the address of the origin server as the host.host.example.com
Example 1: When a user request is redirected to the origin server
example.com
, the value of host ishost.example.com
.{ "Functions": [{ "functionArgs": [{ "argName": "origin", "argValue": "example.com" }, { "argName": "host", "argValue": "host.example.com" }], "functionName": "origin_host" }], "DomainNames": "example.com" }
Example 2: When a user request is redirected to all origin servers, the value of the origin parameter is all, and the value of the host parameter for all origin servers is
host.example.com
.{ "Functions": [{ "functionArgs": [{ "argName": "origin", "argValue": "all" }, { "argName": "host", "argValue": "host.example.com" }], "functionName": "origin_host" }], "DomainNames": "example.com" }
Example 3: When a user request is redirected to all origin servers, the value of origin is all, and the value of host for all origin servers is
ali_follow_origin
, which indicates the address of the origin server.{ "Functions": [{ "functionArgs": [{ "argName": "origin", "argValue": "all" }, { "argName": "host", "argValue": "ali_follow_origin" }], "functionName": "origin_host" }], "DomainNames": "example.com" }
ali_origin_port_scheme
Feature description: configures an origin port and protocol. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 276.
Request parameters
Parameter
Type
Required
Description
Example
port
String
Yes
The origin port.
NoteIf scheme is set to follow, set the value in the following format:
http:80|https:443
.80
scheme
String
Yes
The origin protocol. Valid values: http, https, follow, https_sm, and follow_sm.
http: HTTP.
https: HTTPS.
follow: the protocol that is used by clients.
If the clients use the HTTP protocol, the HTTP protocol is used for origin fetch.
When the client uses the HTTPS protocol:
If the client uses the RSA algorithm, the HTTPS protocol and the RSA algorithm are used for origin fetch.
If the client uses the ShangMi (SM) algorithm, the HTTPS protocol and the RSA algorithm are used for origin fetch.
https_sm: The HTTPS protocol and the SM algorithm are used for origin fetch.
follow_sm: The HTTP or HTTPS protocol that is used by clients is used. The RSA and SM algorithms are supported.
If the clients use the HTTP protocol, the HTTP protocol is used for origin fetch.
When the client uses the HTTPS protocol:
If the client uses the RSA algorithm, the HTTPS protocol and the RSA algorithm are used for origin fetch.
If the client uses the SM algorithm, the HTTPS protocol and the SM algorithm are used for origin fetch.
NoteRSA is an algorithm that complies with international standards. SM is a self-developed algorithm that is widely used in regions in China and is recognized by the State Cryptography Administration.
http
Example 1: Set the scheme parameter to http and the origin port to 80.
{ "Functions": [{ "functionArgs": [{ "argName": "port", "argValue": "80" }, { "argName": "scheme", "argValue": "http" }], "functionName": "ali_origin_port_scheme" }], "DomainNames": "example.com" }
Example 2: Set scheme to follow. When the HTTP protocol is used for origin fetch, requests are sent to port 80 of the origin server. When the HTTPS protocol is used for origin fetch, requests are sent to port 443 of the origin server.
{ "Functions":[{ "functionArgs": [{ "argName": "port", "argValue": "http:80|https:443" }, { "argName": "scheme", "argValue": "follow" }], "functionName":"ali_origin_port_scheme" }], "DomainNames":"example.com" }
origin_sni
Feature description: configures SNI for a specified origin server. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 262.
Request parameters
Parameter
Type
Required
Description
Example
origin
String
Yes
The address of the origin server. If you do not specify an origin address, the origin parameter is automatically set to all.
example.com
sni_host
String
Yes
The SNI host.
You can set this parameter to a fixed value, such as
example.org
.To use the address of the origin server, set this parameter to
ali_follow_origin
.To use the address of the origin host, set this parameter to
ali_follow_host
.
example.org
keepalive_sni
String
No
Specifies whether to enable SNI matching for persistent connections.
on
off
NoteIf you enable SNI matching, requests with different SNI hostnames use different persistent connections.
/
Example 1: When a user request is redirected to the origin server
origin.example.com
, the value of SNI ishost.example.com
.{ "Functions": [{ "functionArgs": [{ "argName": "origin", "argValue": "origin.example.com" }, { "argName": "sni_host", "argValue": "host.example.com" }], "functionName": "origin_sni" }], "DomainNames": "example.com" }
Example 2: When a user request is redirected to all origin servers, the value of origin is
all
, and the value of SNI for all origin servers ishost.example.com
.{ "Functions": [{ "functionArgs": [{ "argName": "origin", "argValue": "all" }, { "argName": "sni_host", "argValue": "host.example.com" }], "functionName":"origin_sni" }], "DomainNames":"example.com" }
Example 3: When a user request is redirected to all origin servers, the value of origin is
all
, and the value of SNI for all origin servers isali_follow_origin
, which indicates the address of the origin server.{ "Functions": [{ "functionArgs": [{ "argName": "origin", "argValue": "all" }, { "argName": "sni_host", "argValue": "ali_follow_origin" }], "functionName": "origin_sni" }], "DomainNames": "example.com" }
Example 4: When a user request is redirected to all origin servers, the value of origin is
all
, and the value of SNI for all origin servers isali_follow_host
, which indicates the address of the origin host.{ "Functions": [{ "functionArgs": [{ "argName": "origin", "argValue": "all" }, { "argName": "sni_host", "argValue": "ali_follow_host" }], "functionName": "origin_sni" }], "DomainNames": "example.com" }
source_group
Feature description: configures an origin server group. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 294.
Request parameters
Parameter
Type
Required
Description
Example
source_group_name
String
Yes
The name of the origin server group. The name can be up to 128 bytes in length and can contain lowercase letters, digits, and underscores (_).
example_origin
source_info
String
Yes
The information about the origin servers in the origin server group. Specify the value in the Origin server address_Priority_Weight_Port format. Separate multiple values with commas (,).
Origin server address: You can specify IPv4 addresses, IPv6 addresses, and domain names.
Priority: The value ranges from 1 to 65535. A smaller value indicates a higher priority.
Weight: The value ranges from 1 to 100. The proportions of requests sent to different origin servers are allocated based on the weights of the origin servers during DCDN origin fetch.
Port: The value ranges from 1 to 65535.
A single origin server: 192.168.0.1_10_33_80
Multiple origin servers: 192.168.0.1_10_33_80,192.0.2.1_10_67_80
retry_times
Integer
No
The number of back-to-origin retries.
3
retry_status_rule
Integer
No
The status code for back-to-origin retries. Valid values: 4xx, 5xx, 404, 404-or-5xx, and 4xx-or-5xx. You can specify only one status code.
404-or-5xx
failback_source
String
No
The basic origin information used for backup. Valid values:
on: If all origin servers in an origin server group are unavailable, the origin server address that is configured in the Origin Information section on the Basic Settings tab is used.
off: If all origin servers in an origin server group are unavailable, a 5xx status code indicating that the origin servers are unavailable is returned to the client.
on
NoteBack-to-origin retry logic:
retry_times: the number of back-to-origin retries.
Retries between IP addresses of the same origin server group are allowed.
The maximum number of retries varies based on the number of available IP addresses in the origin server group.
If you do not set the retry_times parameter, the default number of back-to-origin retries is the smaller one of three and the number of available origin server IP addresses.
If you specify the retry_times parameter, the number of back-to-origin retries is the smaller value between the value of the retry_times parameter and the number of available origin IP addresses.
retry_status_rule: the status code that triggers the point of presence (POP) to retry.
If you do not specify the retry_status_rule parameter, the POP retries when the origin server returns the 5xx status code.
If you specify the retry_status_rule parameter, the POP retries when the origin server returns the status code that you specify. Valid values: 4xx, 5xx, 404, 404-or-5xx, and 4xx-or-5xx. You can specify only one value.
After you specify the retry_status_rule parameter, the default value 5xx status code still takes effect. For example, if the 404 status code is set, the POP retries when the 404 or 5xx status code is received.
Back-to-origin retry order: The retry order is based on the priority of IP addresses in the origin server group in descending order.
Back-to-origin timeout: When the origin server responds to the retry status code, the POP retries after it receives the retry status code. If no retry status code is received from the origin server, the timeout process is followed. After the timeout period is reached, the POP is triggered to retry.
Timeout period for establishing a TCP connection with the origin server: 10 seconds.
Write timeout for the origin server: the period for data write after the TCP connection with the origin server is established. The value is 30 seconds.
Read timeout for the origin server: the period for the origin server to return the content requested by the POP after the connection with the origin server is established. The value is 30 seconds.
Origin server probing logic:
Abnormal TCP connection: If the TCP connection between a POP and an origin server is abnormal, the IP address of the origin server is added to a dead table. This way, subsequent back-to-origin requests are not sent to the IP address. The POP probes the IP address every 5 seconds. If the TCP connection can be established as expected, the IP address of the origin server is removed from the dead table and added to the list of available origin IP addresses.
Normal TCP connection: If the TCP connection between a POP and an origin server is normal but a retry status code, such as 5xx, is returned from the origin server, the IP address of the origin server is not removed from the list of available origin IP addresses. In this case, the retry logic is triggered and subsequent requests are still sent to the IP address of the origin server. If errors occur at Layer 7 when the TCP connection between a POP and an origin server is normal, the IP address of the origin server is not automatically blocked. If you want to block the IP address, you need to configure the monitoring check feature for back-to-origin requests at Layer 7.
Examples:
{ "Functions":[{ "functionArgs":[{ "argName":"source_group_name", "argValue":"test_yidong" },{ "argName":"source_info", "argValue":"192.168.0.1_10_33_80,192.0.2.1_10_67_80" },{ "argName":"retry_times", "argValue":"3" },{ "argName":"retry_status_rule", "argValue":"404,502" },{ "argName":"failback_source", "argValue":"on" }], "functionName":"source_group" }], "DomainNames":"example.com" }
ipv6_origin
Feature description: configures origin fetch over IPv6. For more information, see Configure back-to-origin routing over IPv6.
Feature ID (FunctionID/FuncId): 265.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable origin fetch over IPv6.
on
off
NoteAfter you enable this feature, the origin servers provide IPv6 services.
If both the POP and the origin server have available IPv6 addresses, an IPv6 connection is used.
An IPv4 connection is used in the following scenarios:
The POP does not have an available IPv6 address.
The origin server does not have an available IPv6 address.
The POP and the origin server do not have available IPv6 addresses.
on
follow
String
Yes
Specifies whether to follow the version of the IP protocol that is used by the client.
on
off
NoteAfter you enable this feature, the IP version of the client request is used for origin fetch.
If a client request uses IPv6, an origin server that uses IPv6 is used for origin fetch. If no origin server uses IPv6, an origin server that uses IPv4 is used for origin fetch.
If a client request uses IPv4, an origin server that uses IPv4 is used for origin fetch. If no origin server uses IPv4, an origin server that uses IPv6 is used for origin fetch.
on
ipv6_v4_mix_used
String
No
Specifies whether to enable the IPv4 or IPv6 polling feature.
on
off
NoteThis feature is mutually exclusive with origin fetch over IPv6 and IP protocol following.
When the IPv4/IPv6 polling feature is enabled, polling is used to determine the IP address of the origin server for origin fetch, regardless of whether the requests are sent over IPv4 or IPv6, or how many IPv4 and IPv6 addresses does the origin server have.
If you configure the weight ratio of IPv4 and IPv6 addresses, origin fetch is performed based on the weight ratio.
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" },{ "argName": "follow", "argValue": "on" }], "functionName": "ipv6_origin" }], "DomainNames": "example.com" }
Cache settings
filetype_based_ttl_set
Feature description: configures a time-to-live (TTL) for files. For more information, see Add a cache rule for resources.
Feature ID (FunctionID/FuncId): 6.
Request parameters
Parameter
Type
Required
Description
Example
ttl
Integer
Yes
The TTL. Unit: seconds. Valid values: 1 to 99999999, which is more than 3 years.
500000
file_type
String
Yes
The file name extensions, which are case-sensitive. Separate file name extensions with commas (,). Example: jpg,txt.
jpg
weight
Integer
No
The weight. Valid values: 1 to 99.
NoteDefault value: 1. A higher value indicates a higher priority.
1
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "file_type", "argValue": "jpg" }, { "argName": "weight", "argValue": "1" }, { "argName": "ttl", "argValue": "500000" }], "functionName": "filetype_based_ttl_set" }], "DomainNames": "example.com" }
path_based_ttl_set
Feature description: configures a TTL for directories. For more information, see Add a cache rule for resources.
Feature ID (FunctionID/FuncId): 7.
Request parameters
Parameter
Type
Required
Description
Example
ttl
Integer
Yes
The TTL. Unit: seconds. Valid values: 1 to 99999999, which is more than 3 years.
500000
path
String
Yes
The directory. The directory must start with a forward slash (/).
/example/demo
weight
Integer
No
The weight. Valid values: 1 to 99.
NoteDefault value: 1. A higher value indicates a higher priority.
1
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "path", "argValue": "/example/demo" }, { "argName": "weight", "argValue": "1" }, { "argName": "ttl", "argValue": "500000" }], "functionName": "path_based_ttl_set" }], "DomainNames": "example.com" }
filetype_force_ttl_code
Feature description: configures a TTL for HTTP status codes of files. For more information, see Create a cache rule for HTTP status codes.
Feature ID (FunctionID/FuncId): 63.
Request parameters
Parameter
Type
Required
Description
Example
file_type
String
Yes
The file name extensions. The file name extensions are case-sensitive. Separate multiple values with commas (,). Example: jpg,txt.
jpg
code_string
String
Yes
The status code and its TTL. The TTL is measured in seconds. The maximum TTL is 3 years. Separate multiple key-value pairs with commas (,). Example: 302=0,301=0,4xx=2.
403=10
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "file_type", "argValue": "jpg" }, { "argName": "code_string", "argValue": "403=10" }], "functionName": "filetype_force_ttl_code" }], "DomainNames": "example.com" }
path_force_ttl_code
Feature description: configures a TTL for HTTP status codes of directories. For more information, see Create a cache rule for HTTP status codes.
Feature ID (FunctionID/FuncId): 65.
Request parameters
Parameter
Type
Required
Description
Example
path
String
Yes
The directory. The directory must start with a forward slash (/). Example: /image.
/example/demo
code_string
String
Yes
The status code and its TTL. Unit: seconds. Valid values: 1 to 99999999 (more than three years). Separate multiple key-value pairs with commas (,). Example: 302=0,301=0,4xx=2.
403=10,404=15
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "path", "argValue": "/example/demo" }, { "argName": "code_string", "argValue": "403=10,404=15" }], "functionName": "path_force_ttl_code" }], "DomainNames": "example.com" }
default_ttl_code
Feature description: configures status code expiration (origin cache policy prioritized).
Feature ID (FunctionID/FuncId): 207.
Request parameters
Parameter
Type
Required
Description
Example
default_ttl_code
String
Yes
The status code and its TTL. Unit: seconds. Valid values: 1 to 99999999 (more than 3 years). Separate multiple values with commas (,).
4xx=3,200=3600,5xx=1
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "default_ttl_code", "argValue": "4xx=3,200=3600,5xx=1" }], "functionName": "default_ttl_code" }], "DomainNames": "example.com" }
set_resp_header
Feature description: configures a custom HTTP response header. For more information, see Configure a custom HTTP response header.
Feature ID (FunctionID/FuncId): 27.
Request parameters
Parameter
Type
Required
Description
Example
key
String
Yes
The response header.
Cache-Control
value
String
Yes
The header value. Separate header values with commas (,).
NoteIf you want to delete a response header, set the header value to null.
no-cache
header_operation_type
String
No
The operation that you want to perform on the header. Valid values:
add
delete
modify
rewrite
add
duplicate
String
No
Specifies whether to allow duplicate request headers. If you set the header_operation_type parameter to add, you need to specify this parameter.
on
off
off
header_source
String
No
The header value that you want to replace. If header_operation_type is set to rewrite, you need to specify this parameter. Regular expressions are supported.
value1
header_destination
String
No
The header value that is used to replace the original header value. If you set the header_operation_type parameter to rewrite, you need to specify this parameter.
value123
match_all
String
No
The match mode. If you set the header_operation_type parameter to rewrite, you need to specify a match mode. Valid values:
on: All header values that match the search condition are replaced.
off: Only the first value that matches the search condition is replaced.
/
access_origin_control
String
No
Specifies whether to enable cross-origin resource sharing (CORS).
on
off
/
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "header_operation_type", "argValue": "add" }, { "argName": "key", "argValue": "Cache-Control" }, { "argName": "value", "argValue": "no-cache" }, { "argName": "duplicate", "argValue": "off" }], "functionName": "set_resp_header" }], "DomainNames": "example.com" }
error_page
Feature description: configures a custom error page. For more information, see Create a custom error page.
Feature ID (FunctionID/FuncId): 15.
Request parameters
Parameter
Type
Required
Description
Example
error_code
Integer
Yes
The HTTP status code.
404
rewrite_page
String
Yes
The page to which requests are redirected.
http://example.aliyundoc.com/error404.html
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "error_code", "argValue": "404" }, { "argName": "rewrite_page", "argValue": "http://example.aliyundoc.com/error404.html" }], "functionName": "error_page" }], "DomainNames": "example.com" }
host_redirect
Feature description: configures a URI rewrite rule. For more information, see Create a URI rewrite rule.
Feature ID (FunctionID/FuncId): 43.
Request parameters
Parameter
Type
Required
Description
Example
regex
String
Yes
The URI that you want to rewrite. It must start with a forward slash (/) and cannot contain http:// or a domain name. You can use Perl Compatible Regular Expressions (PCRE) to specify the URI. Example: ^/hello$.
^/hello$
replacement
String
Yes
The final URI. It must start with a forward slash (/) and cannot contain http:// or a domain name.
/hello/test
flag
String
Yes
The operation that you want POPs to perform after a URI is rewritten. Valid values:
redirect: If the URI in a request matches the current rule, DCDN returns the HTTP 302 status code and the request is redirected to the final URI. After the current rule is executed, the request is matched against other rules.
break: If the URI in a request matches the current rule, the request is redirected to the final URI. After the current rule is executed, other rules are skipped.
redirect
rewrite_method
String
No
The redirection method. Valid values: 302, 303, and 307.
302: This is the default redirection method. The GET request method does not change. Other request methods may be changed to GET.
303: The GET request method does not change. Other request methods may be changed to GET, and the message body is dropped.
307: The request method and message body remain unchanged.
302
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "flag", "argValue": "redirect" }, { "argName": "regex", "argValue": "^/hello$" }, { "argName": "replacement", "argValue": "/hello/test" }, { "argName": "rewrite_method", "argValue": "302" }], "functionName": "host_redirect" }], "DomainNames": "example.com" }
self_defined_cachekey
Feature description: configures custom cache keys. This feature can only be used after your account is added to the whitelist. If you want to use this feature, submit a ticket.
Feature ID (FunctionID/FuncId): 227.
Request parameters
Parameter
Type
Required
Description
Example
uri
Array of String
No
Specifies whether to rewrite a URI and save the final URI as a cache key.
uri_to_rewrite: the original URI that you want to rewrite.
ai_uri_regex: the final URI.
[{"uri_to_rewrite":"/hello","ai_uri_regex":"/hello/test"}]
args
Array of String
No
Specifies whether to add, delete, modify, or retain parameters in requests, and save the final URI as a cache key. Valid values:
args_operation_type: the operation that you want to perform. Valid values: add, delete, modify, and keep.
args: the content that you want to add, delete, modify, or keep.
[{"args":"test=123","args_operation_type":"add"}]
headers
String
No
The HTTP headers that you want to add to the URI and the cache key. Separate multiple headers with spaces.
example
variable
Array of String
No
The custom variable. You can use a regular expression to extract fields from request parameters, HTTP headers, cookies, and URIs. Then, you can add the extracted fields to cache keys.
[]
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "uri", "argValue": [{ "uri_to_rewrite": "/hello", "ai_uri_regex": "/hello/test" }] }, { "argName": "args", "argValue": [{ "args": "test=123", "args_operation_type": "add" }] }, { "argName": "headers", "argValue": "" }, { "argName": "variable", "argValue": [] }], "functionName": "self_defined_cachekey" }], "DomainNames": "example.com" }
rewrite_host
Feature description: configures cache sharing.
Feature ID (FunctionID/FuncId): 54.
Request parameters
Parameter
Type
Required
Description
Example
share_host
String
Yes
The domain name with which you want the current domain name to share cache. Configuring this parameter does not modify the origin host of the request. The value of share_host is used to generate a cache key for the query.
example.com
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "share_host", "argValue": "example.com" }], "functionName": "rewrite_host" }], "DomainNames": "example.com" }
HTTPS settings
https_option
Feature description: configures basic HTTPS parameters. For more information, see Configure an SSL certificate, Enable HTTP/2, and Configure OCSP stapling.
Feature ID (FunctionID/FuncId): 78.
Request parameters
Parameter
Type
Required
Description
Example
http2
String
No
Specifies whether to enable HTTP/2.
on
off
on
ocsp_stapling
String
No
Specifies whether to enable Online Certificate Status Protocol (OCSP) stapling.
on
off
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "http2", "argValue": "on" }, { "argName": "ocsp_stapling", "argValue": "on" }], "functionName": "https_option" }], "DomainNames": "example.com" }
http_force
Feature description: configures URL redirection to HTTP. For more information, see Configure force redirect.
Feature conflicts: The URL redirection to HTTP feature conflicts with the URL redirection to HTTPS feature (function: https_force, feature ID: 44). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 45.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable URL redirection to HTTP. Valid values:
on
off
on
http_rewrite
String
No
The redirection method. Valid values: 301 and 308.
301: The GET request method does not change. Other request methods may be changed to GET.
308: The request method and message body remain unchanged.
301
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "http_rewrite", "argValue": "301" }], "functionName": "http_force" }], "DomainNames": "example.com" }
https_force
Feature description: configures URL redirection to HTTPS. For more information, see Configure force redirect.
Feature conflicts: The URL redirection to HTTPS feature conflicts with the URL redirection to HTTP feature (function: http_force, feature ID: 45). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 44.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable URL redirection to HTTPS. Valid values:
on
off
on
https_rewrite
String
No
The redirection method. Valid values: 301 and 308.
301: The GET request method does not change. Other request methods may be changed to GET.
308: The request method and message body remain unchanged.
301
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "https_rewrite", "argValue": "301" }], "functionName": "https_force" }], "DomainNames": "example.com" }
https_tls_version
Feature description: configures a TLS version. For more information, see Configure TLS version control.
Feature ID (FunctionID/FuncId): 110.
Request parameters
Parameter
Type
Required
Description
Example
tls10
String
No
Specifies whether to enable TLS 1.0. Default value: on. Valid values:
on
off
on
tls11
String
No
Specifies whether to enable TLS 1.1. Default value: on. Valid values:
on
off
on
tls12
String
No
Specifies whether to enable TLS 1.2. Default value: on. Valid values:
on
off
on
tls13
String
No
Specifies whether to enable TLS 1.3. Default value: on. Valid values:
on
off
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "tls10", "argValue": "on" }, { "argName": "tls11", "argValue": "on" }, { "argName": "tls12", "argValue": "on" }, { "argName": "tls13", "argValue": "on" }, ], "functionName": "https_tls_version" }], "DomainNames": "example.com" }
HSTS
Feature description: configures HTTP Strict Transport Security (HSTS). For more information, see Configure HSTS.
Feature ID (FunctionID/FuncId): 112.
Request parameters
Parameter
Type
Required
Description
Example
enabled
String
Yes
Specifies whether to enable HSTS. Valid values:
on
off
on
https_hsts_max_age
Integer
Yes
The TTL, in seconds.
NoteWe recommend that you set the TTL to 5184000 seconds (60 days).
5184000
https_hsts_include_subdomains
String
No
Specifies whether to include subdomains in HSTS headers. Valid values: on and off.
NoteProceed with caution when you enable this feature. Make sure that HTTPS is enabled for all the subdomains of the accelerated domain name. Otherwise, the HTTPS URLs to which requests are redirected from the subdomains become inaccessible.
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enabled", "argValue": "on" }, { "argName": "https_hsts_max_age", "argValue": "5184000" }, { "argName": "https_hsts_include_subdomains", "argValue": "off" }], "functionName": "HSTS" }], "DomainNames": "example.com" }
Access control settings
referer_white_list_set
Feature description: configures a Referer whitelist. For more information, see Configure a Referer whitelist or blacklist to enable hotlink protection.
Feature conflicts: The Referer whitelist feature conflicts with the Referer blacklist feature (function: referer_black_list_set, feature ID: 5). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 1.
Request parameters
Parameter
Type
Required
Description
Example
refer_domain_allow_list
String
Yes
The domain names that you want to add to the Referer whitelist. You can specify multiple domain names. Separate the domain names with commas (,).
example.aliyundoc.com,demo.aliyundoc.com
allow_empty
String
No
Requests with an empty Referer header are allowed to access DCDN resources. Default value: off. Valid values:
on
off
off
redirect_url
String
No
The redirect URL. If the Referer information in the request does not match the information in the whitelist, the 403 status code is not returned after the request is blocked. In this case, the 302 status code and the Location header are returned. This parameter is the value of the Location header and starts with http:// or https://.
http://www.example.com
disable_ast
String
No
Specifies whether to enable exact match for domain names in the whitelist. Default value: off. If you set this parameter to on, exact match for domain names is enabled.
If you set this parameter to on, the following rules apply:
Exact match is supported.
If you add
example.com
to the whitelist,example.com
is matched.If you add
a*b.example.com
to the whitelist,a<Any characters>b.example.com
is matched.
Suffix match is not supported.
If you set this parameter to off, the following rules apply:
Exact match is not supported.
Suffix match is supported.
If you add
example.com
to the whitelist,example.com
and<Any characters>.example.com
are matched.If you add
a*b.example.com
to the whitelist,a<Any characters>b.example.com
and<Any characters>.a<Any characters>b.example.com
are matched.
off
ignore_scheme
String
No
Specifies whether to ignore the scheme parameter. Default value: off. After you enable this feature, if the Referer in the request does not have an HTTP or HTTPS header, the Referer is still considered valid.
If you set this parameter to on, the Referer is in the following format:
referer: www.example.com
If you set this parameter to off, the Referer is in the following format:
referer: https://www.example.com
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "allow_empty", "argValue": "off" }, { "argName": "refer_domain_allow_list", "argValue": "example.aliyundoc.com,demo.aliyundoc.com" }], "functionName": "referer_white_list_set" }], "DomainNames": "example.com" }
referer_black_list_set
Feature description: configures a Referer blacklist. For more information, see Configure a Referer whitelist or blacklist to enable hotlink protection.
Feature conflicts: The Referer blacklist feature conflicts with the Referer whitelist feature (function: referer_white_list_set, feature ID: 1). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 5.
Request parameters
Parameter
Type
Required
Description
Example
refer_domain_deny_list
String
Yes
The domain names that you want to add to the Referer blacklist. You can specify multiple domain names. Separate the domain names with commas (,).
example.aliyundoc.com,demo.aliyundoc.com
allow_empty
String
No
Requests with an empty Referer header are allowed to access DCDN resources.
on
off
off
redirect_url
String
No
The redirect URL. If the Referer information in the request matches the information in the blacklist, the 403 status code is not returned after the request is blocked. In this case, the 302 status code and the Location header are returned. This parameter is the value of the Location header and starts with http:// or https://.
http://www.example.com
disable_ast
String
No
Specifies whether to enable exact match for domain names in the blacklist. Default value: off. If you set this parameter to on, exact match for domain names is enabled.
If you set this parameter to on, the following rules apply:
Exact match is supported.
If you add
example.com
to the blacklist,example.com
is matched.If you add
a*b.example.com
to the blacklist,a<Any characters>b.example.com
is matched.
Suffix match is not supported.
If you set this parameter to off, the following rules apply:
Exact match is not supported.
Suffix match is supported.
If you add
example.com
to the blacklist,example.com
and<Any characters>.example.com
are matched.If you add
a*b.example.com
to the blacklist,a<Any characters>b.example.com
and<Any characters>.a<Any characters>b.example.com
are matched.
off
ignore_scheme
String
No
Specifies whether to ignore the scheme parameter. Default value: off. After you enable this feature, if the Referer in the request does not have an HTTP or HTTPS header, the Referer is still considered valid.
If you set this parameter to on, the Referer is in the following format:
referer: www.example.com
If you set this parameter to off, the Referer is in the following format:
referer: https://www.example.com
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "allow_empty", "argValue": "off" }, { "argName": "refer_domain_deny_list", "argValue": "example.aliyundoc.com,demo.aliyundoc.com" }], "functionName": "referer_black_list_set" }], "DomainNames": "example.com" }
aliauth
Feature description: configures URL signing. For more information, see Configure URL signing.
Feature ID (FunctionID/FuncId): 25.
Request parameters
Parameter
Type
Required
Description
Example
auth_m3u8
String
No
Specifies whether to enable M3U8 rewrite. M3U8 rewrite authenticates access to TS files. If M3U8 rewrite is disabled, access to TS files may be denied. Valid values: on and off. Default value: on.
on
auth_type
String
Yes
The signing type. Valid values:
no_auth: disables URL signing.
type_a: enables type A signing.
type_b: enables type B signing.
type_c: enables type C signing.
type_a
auth_key1
String
Yes
The cryptographic key 1. The key must be 16 to 128 characters in length, and can contain letters and digits.
1234567890123456789
auth_key2
String
No
The cryptographic key 2. The key must be 16 to 128 characters in length, and can contain letters and digits.
1234567890123456789
ali_auth_delta
Integer
No
The TTL of the signed URLs. Unit: seconds. Default value: 1800.
1800
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "auth_type", "argValue": "type_a" }, { "argName": "auth_key1", "argValue": "1234567890123456789" }, { "argName": "auth_key2", "argValue": "1234567890123456789" }, { "argName": "ali_auth_delta", "argValue": 1800 }], "functionName": "aliauth" }], "domainNames": "example.com" }
cdn_remote_auth
Feature description: configures remote authentication.
Feature ID (FunctionID/FuncId): 258.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable remote authentication.
on
off
on
remote_auth_addr
String
Yes
The address of the authentication server. Format:
https://dcdn.aliyun.com/auth
orhttp://10.10.10.10/auth
.https://example.aliyundoc.com/auth
remote_auth_method
String
Yes
The request method. Valid values: get, post, and head.
get
remote_auth_type
String
Yes
The type of the authentication file. The value all specifies all types. Separate file types with vertical bars (|). The value is case-sensitive. For example, jpg is different from JPG.
all
remote_auth_reserve_args
String
Yes
The parameters that you want to retain. The value all specifies that all parameters are retained. Separate parameters with vertical bars (|). The value ali_delete_all_args specifies that all parameters are deleted. The value is case-sensitive. For example, key is different from KEY.
all
remote_auth_custom_args
String
No
The parameters that you want to add. Separate parameters with vertical bars (|). The value is case-sensitive. For example, key is different from KEY.
None
remote_auth_reserve_header
String
Yes
The request headers that you want to retain.
all: retains all request headers. Separate multiple request headers with vertical bars (|).
ali_delete_all_headers: deletes all request headers. The value is not case-sensitive. For example, http_remote_addr is equivalent to HTTP_Remote_Addr.
all
remote_auth_custom_header
String
No
The request headers that you want to add. Separate multiple request headers with vertical bars (|). The value is not case-sensitive. For example, http_remote_addr is equivalent to HTTP_Remote_Addr.
None
remote_auth_success_code
Integer
Yes
The HTTP status code that is returned to DCDN when a request passes authentication. Example: 200. You can configure multiple HTTP status codes. Separate HTTP status codes with commas (,).
200
remote_auth_fail_code
Integer
Yes
The HTTP status code that is returned to DCDN when a request fails authentication. Example: 403. You can configure multiple HTTP status codes. Separate HTTP status codes with commas (,).
403,404
remote_auth_other_code_act
String
No
The operation to perform when the HTTP status code that is returned to DCDN does not indicate that a request passes or fails authentication. Valid values:
pass (default): DCDN allows the request.
Reject: DCDN rejects the request.
pass
remote_auth_fail_resp_code
Integer
Yes
The HTTP status code that is returned by DCDN when a request fails authentication. For example, if you set this parameter to 403, DCDN returns the HTTP 403 status code to the user when a request fails authentication.
403
remote_auth_timeout
Integer
Yes
The authentication timeout period. Unit: milliseconds. Maximum value: 3000.
500
remote_auth_timeout_action
String
Yes
The action that is performed when authentication times out. Valid values:
pass: DCDN allows the request.
reject: DCDN returns the specified HTTP status code for authentication failures to the user.
pass
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "remote_auth_addr", "argValue": "https://example.aliyundoc.com/auth" }, { "argName": "remote_auth_method", "argValue": "get" }, { "argName": "remote_auth_type", "argValue": "all" }, { "argName": "remote_auth_reserve_args", "argValue": "all" }, { "argName": "remote_auth_custom_args", "argValue": "" }, { "argName": "remote_auth_reserve_header", "argValue": "all" }, { "argName": "remote_auth_custom_header", "argValue": "" }, { "argName": "remote_auth_success_code", "argValue": "200" }, { "argName": "remote_auth_fail_code", "argValue": "403" }, { "argName": "remote_auth_other_code_act", "argValue": "pass" }, { "argName": "remote_auth_fail_resp_code", "argValue": "403" }, { "argName": "remote_auth_timeout", "argValue": 500 }, { "argName": "remote_auth_timeout_action", "argValue": "pass" }], "functionName": "cdn_remote_auth" }], "DomainNames": "example.com" }
ip_allow_list_set
Feature description: configures an IP address whitelist. For more information, see Configure an IP blacklist or whitelist.
Feature conflicts: The IP address whitelist feature conflicts with the IP address blacklist feature (function: ip_black_list_set, feature ID: 13). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 69.
Request parameters
Parameter
Type
Required
Description
Example
ip_list
String
Yes
The IP addresses that you want to add to the whitelist. You can specify multiple IP addresses. Separate IP addresses with commas (,).
192.168.0.1/24
ip_acl_xfwd
String
No
Specifies whether to use the IP address in the X-Forwarded-For header for verification. Valid values:
on (default): uses the first IP address in the
X-Forwarded-For
request header for verification.off: uses the
IP address that is used to connect to the POP
for verification.all: uses both the first IP address in the
X-Forwarded-For
request header and theIP address that is used to connect to the POP
for verification.
all
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "ip_list", "argValue": "192.168.0.1/24" }], "functionName": "ip_allow_list_set" }], "DomainNames": "example.com" }
ip_black_list_set
Feature description: configures an IP address blacklist. For more information, see Configure an IP blacklist or whitelist.
Feature conflicts: The IP address blacklist feature conflicts with the IP address whitelist feature (function: ip_allow_list_set, feature ID: 69). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 13.
Request parameters
Parameter
Type
Required
Description
Example
ip_list
String
Yes
The IP addresses that you want to add to the blacklist. You can specify multiple IP addresses. Separate the IP addresses with commas (,).
192.168.0.1
ip_acl_xfwd
String
No
Specifies whether to use the IP address in the X-Forwarded-For header for verification. Valid values:
on (default): uses the first IP address in the
X-Forwarded-For
request header for verification.off: uses the
IP address that is used to connect to the POP
for verification.all: uses both the first IP address in the
X-Forwarded-For
request header and theIP address that is used to connect to the POP
for verification.
all
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "ip_list", "argValue": "192.168.0.1" }], "functionName": "ip_black_list_set" }], "DomainNames": "example.com" }
ali_ua
Feature description: configures a User-Agent whitelist or blacklist. For more information, see Configure a User-Agent blacklist or whitelist.
Feature ID (FunctionID/FuncId): 58.
Request parameters
Parameter
Type
Required
Description
Example
ua
String
Yes
The user agents that you want to add to the whitelist or blacklist. You can use asterisks (*) to match any characters and specify multiple values. Separate the values with vertical bars (|). Example:
*curl*|*IE*|*chrome*|*firefox*
.*curl*|*IE*|*chrome*|*firefox*
type
String
Yes
The type of the list. Valid values:
black: a blacklist.
white: a whitelist.
NoteThe blacklist and whitelist are mutually exclusive. You can enable only one type of list.
black
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "ua", "argValue": "*curl*|*IE*|*chrome*|*firefox*" }, { "argName": "type", "argValue": "black" }], "functionName": "ali_ua" }], "DomainNames": "example.com" }
Performance optimization
tesla
Feature description: configures HTML optimization. For more information, see Configure HTML optimization.
Feature ID (FunctionID/FuncId): 16.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable HTML optimization. Valid values:
on
off
on
trim_js
String
No
Specifies whether to optimize the JavaScript code of HTML pages. Default value: off. Valid values:
on
off
off
trim_css
String
No
Specifies whether to optimize the CSS code of HTML pages. Default value: off. Valid values:
on
off
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "trim_css", "argValue": "off" }, { "argName": "trim_js", "argValue": "off" }], "functionName": "tesla" }], "DomainNames": "example.com" }
gzip
Feature description: configures Gzip compression. For more information, see Use the Gzip compression feature.
Feature ID (FunctionID/FuncId): 35.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable Gzip compression. Valid values:
on
off
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }], "functionName": "gzip" }], "DomainNames": "example.com" }
brotli
Feature description: configures Brotli compression. For more information, see Configure Brotli compression.
Feature ID (FunctionID/FuncId): 97.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable Brotli compression. Valid values:
on
off
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }], "functionName": "brotli" }], "DomainNames": "example.com" }
set_hashkey_args
Feature description: retains URL parameters. For more information, see Parameter filtering.
Feature conflicts: The URL parameter retaining feature conflicts with the URL parameter deleting feature (function: ali_remove_args, feature ID: 75). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 19.
Request parameters
Parameter
Type
Required
Description
Example
hashkey_args
String
No
The parameters that you want to retain. You can specify up to 10 parameters. Separate parameters with commas (,).
key1,key2
disable
String
Yes
Specifies whether to ignore all parameters. Default value: off. Valid values:
on: ignores all parameters. Only the Add rule takes effect.
off: does not ignore parameters. The Retain, Add, and Delete rules take effect.
NoteThe hashkey_args setting has a higher priority. Even if you set this parameter to on, the parameters that are specified by the hashkey_args parameter are retained.
on
keep_oss_args
String
Yes
Specifies whether to retain parameters during origin fetch. Valid values:
on: All parameters are retained during origin fetch.
off: Only the parameters that are specified in hashkey are retained.
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "hashkey_args", "argValue": "" }, { "argName": "keep_oss_args", "argValue": "on" }, { "argName": "disable", "argValue": "on" }], "functionName": "set_hashkey_args" }], "DomainNames": "example.com" }
ali_remove_args
Feature description: deletes URL parameters. For more information, see Parameter filtering.
Feature conflicts: The URL parameter deleting feature conflicts with the URL parameter retaining feature (function: set_hashkey_args, feature ID: 19). You can use only one of the two features. If you have configured one of the features, you need to delete the configuration of the feature before you configure the other feature. You can call the DeleteDcdnSpecificConfig operation to delete configurations of a domain name. If a feature has a switch parameter and the parameter is set to off, the feature is still considered configured.
Feature ID (FunctionID/FuncId): 75.
Request parameters
Parameter
Type
Required
Description
Example
ali_remove_args
String
Yes
The parameters that you want to delete. Separate multiple parameters with spaces.
NoteThe parameters that are retained are used as the URL parameters in hashkey.
test
keep_oss_args
String
Yes
Specifies whether to retain parameters during origin fetch. Valid values:
on: All parameters are retained during origin fetch.
off: Only the parameters that are specified in hashkey are retained.
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "ali_remove_args", "argValue": "test" }, { "argName": "keep_oss_args", "argValue": "off" }], "functionName": "ali_remove_args" }], "DomainNames": "example.com" }
image_transform
Feature description: configures image editing. For more information, see Image editing and its benefits.
Feature ID (FunctionID/FuncId): 239.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable image editing.
on
off
on
filetype
String
Yes
The image format that you want to convert. Separate multiple values with vertical bars (|).
jpg|jpeg|png
webp
String
No
Specifies whether to enable automatic conversion to WebP.
on
off
on
orient
String
No
Specifies whether to enable automatic rotation.
on
off
NoteThis feature takes effect only for images that carry rotation properties.
on
slim
Integer
No
The image compression rate. Valid values: 0 to 100. Image compression reduces data transfer without changing the resolution, size, or format of images.
10
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "filetype", "argValue": "jpg|jpeg|png" }, { "argName": "webp", "argValue": "on" }, { "argName": "orient", "argValue": "on" }, { "argName": "slim", "argValue": "" }, { "argName": "enable", "argValue": "on" }], "functionName": "image_transform" }], "DomainNames": "example.com" }
Video-related settings
range
Feature description: configures range origin fetch. For more information, see Configure range origin fetch.
Feature ID (FunctionID/FuncId): 31.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable range origin fetch. Valid values:
on
off
force: forcibly enables range origin fetch.
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }], "functionName": "range" }], "DomainNames": "example.com" }
video_seek
Feature description: configures video seeking. For more information, see Configure video seeking.
Feature ID (FunctionID/FuncId): 30.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable video seeking. Valid values:
on
off
on
flv_seek_by_time
String
No
Specifies whether to enable video seeking by time for Flash Video (FLV) files. Valid values:
on
off
on
mp4_seek_start
String
No
The custom start parameter for MP4 files.
mp4starttime
mp4_seek_end
String
No
The custom end parameter for MP4 files.
mp4endtime
flv_seek_start
String
No
The custom start parameter for FLV files.
flvstarttime
flv_seek_end
String
No
The custom end parameter for FLV files.
flvendtime
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }], "functionName": "video_seek" }], "DomainNames": "example.com" }
ali_video_split
Feature description: configures audio extraction.
Feature ID (FunctionID/FuncId): 204.
Request parameters
Parameter
Type
Required
Description
Example
enabled
String
Yes
Specifies whether to enable audio extraction.
on
off
on
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }], "functionName": "ali_video_split" }], "DomainNames": "example.com" }
ali_video_preview
Feature description: configures video preview.
Feature ID (FunctionID/FuncId): 205.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable video preview.
on
off
NoteThe following file formats are supported: TS, MP3, FLV, and MP4.
on
ali_video_preview_argument
String
Yes
The custom preview parameter. Unit of this parameter: seconds.
fds
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "ali_video_preview_argument", "argValue": "fds" }], "functionName": "ali_video_preview" }], "DomainNames": "example.com" }
hls_token_rewrite
Feature description: configures M3U8 encryption and rewrite.
Feature ID (FunctionID/FuncId): 253.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable M3U8 encryption and rewrite.
on
off
on
hls_token_arg_name
String
No
The custom parameter name for the HLS token. If you do not specify a name, MtsHlsUriToken is used as the name.
example
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }], "functionName": "hls_token_rewrite" }], "DomainNames": "example.com", }
Security settings
ddos_domain
Feature description: configures DDoS mitigation. For more information, see DDoS mitigation.
Feature ID (FunctionID/FuncId): 209.
Request parameters
Parameter
Type
Required
Description
Example
enable
String
Yes
Specifies whether to enable DDoS mitigation. Valid values:
on
off
on
dispatch_qps
String
Yes
The QPS threshold.
Valid values: 2000 to 50000.
Default value: 20000.
20000
checkurl
String
Yes
The path of the domain name that needs health check.
Default value:
/
, which indicates the default root directory of the domain name./*/examplefile.txt
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enable", "argValue": "on" }, { "argName": "dispatch_qps", "argValue": "20000" }, { "argName": "checkurl", "argValue": "/*/examplefile.txt" }], "functionName": "ddos_domain" }], "DomainNames": "example.com" }
Traffic throttling
limit_rate
Feature description: configures throttling for individual requests.
Feature ID (FunctionID/FuncId): 72.
Request parameters
You can specify only the ali_limit_rate parameter or specify parameters carried in the request URL to configure throttling. You can also configure the start and end time for throttling.
You can configure throttling by specifying the traffic_limit_arg and traffic_limit_unit parameters carried in the request URL.
You can configure the start time and end time for throttling by specifying the ali_limit_start_hour and ali_limit_end_hour parameters.
Parameter
Type
Required
Description
Example
ali_limit_rate
String
Yes
The throttling rate for individual requests, such as 200 KB/s or 1 MB/s. The value can contain a number and a letter (k or m). The unit is byte/s.
The minimum value is 100k, and smaller values are rounded up to 100k.
1m: The throttling rate for individual requests is 1 MB/s.
100k: The throttling rate for individual requests is 100 KB/s.
ali_limit_rate_after
String
No
The threshold value based on which throttling is triggered. The value contains a number and an optional letter (k or m). The unit is byte.
1000
traffic_limit_arg
String
No
The name of the throttling parameter. Throttling is performed based on the value of the specified parameter in URLs. Sample parameter: rate.
If the request does not contain a throttling parameter, the throttling rate is the value of ali_limit_rate. If the request does not contain the throttling parameter, set ali_limit_rate to 0k to disable throttling.
rate
traffic_limit_unit
String
No
The unit of the throttling parameter traffic_limit_arg. Valid values: m (MB/s) and k (KB/s). If you set the value to m, the throttling rate is 1 MB/s when the rate that is carried in the request URL is 1.
The minimum value is 100k, and smaller values are rounded up to 100k.
m
ali_limit_start_hour
Integer
No
The point in time at which throttling starts. Valid values: 0 to 24. Default value: 0. The start time must be earlier than the end time.
NoteSpecify a time in the 24-hour format. The time must be on the hour. For example, 00:00:00 represents 0 o'clock and 24:00:00 represents 24 o'clock.
20
ali_limit_end_hour
Integer
No
The point in time at which throttling ends. Valid values: 0 to 24. Default value: 24. The end time must be later than the start time.
23
Example 1: Set the throttling rate for individual requests to 1 MB/s.
{ "Functions": [{ "functionArgs": [{ "argName": "ali_limit_rate", "argValue": "1m" }], "functionName": "limit_rate" }], "DomainNames": "example.com" }
Example 2: The default throttling rate for individual requests is 1 MB/s. If the request URL contains the rate parameter, the throttling rate is the value of the parameter. For example, if the rate parameter in a user request is 200, the throttling rate is 200 KB/s.
{ "Functions": [{ "functionArgs": [{ "argName": "ali_limit_rate", "argValue": "1m" },{ "argName": "traffic_limit_arg", "argValue": "rate" },{ "argName": "traffic_limit_unit", "argValue": "k" }], "functionName": "limit_rate" }], "DomainNames": "example.com" }
WebSocket
websocket
Feature description: configures WebSocket. For more information, see Configure WebSocket.
Feature ID (FunctionID/FuncId): 144.
Request parameters
Parameter
Type
Required
Description
Example
enabled
String
Yes
Specifies whether to enable WebSocket. Valid values:
on
off
on
origin_scheme
String
No
The protocol over which requests are redirected to the origin server when WebSocket is used. Valid values:
http: DCDN redirects requests to the origin server over HTTP.
https: DCDN redirects requests to the origin server over HTTPS. Port 443 of the origin server must be open.
follow: DCDN uses the same protocol (HTTP or HTTPS) as the client to redirect requests to the origin server. Port 443 or 80 of the origin server must be open.
NoteDefault value: follow.
http
heartbeat
String
No
The connection timeout period.
Valid values: 1 to 300.
Unit: seconds.
Default value: 60.
60
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "enabled", "argValue": "on" }, { "argName": "origin_scheme", "argValue": "http" }, { "argName": "heartbeat", "argValue": "60" }], "functionName": "websocket" }], "DomainNames": "example.com" }
IPA
protogw
Feature description: configures IP Application Accelerator (IPA). For more information, see What is IP Application Accelerator?
Feature ID (FunctionID/FuncId): 163.
Request parameters
Parameter
Type
Required
Description
Example
realip
String
Yes
Specifies whether to enable the passthrough of client IP addresses. Valid values:
off: disables the passthrough of client IP addresses.
toa: The TCP Option Address (TOA) kernel module inserts the source IP address of a client to the option field in the TCP protocol. Before you use this method, make sure that the origin server has the TOA kernel module installed. No modifications are required for the application.
pp: The proxy protocol inserts the source IP address of a client into the TCP payload. By default, the proxy protocol is supported by the open source versions of NGINX. For other applications on the origin server, make sure that the proxy protocol is supported.
toa
port
String
Yes
The acceleration port.
NoteThe following ports are not supported: 22, 123, 161, 162, 179, 830, 2049, 2601, 2605, 3389, 5049, 7547, 8082, 8087, 8182, 8888, 9998, 15772, 15776, 15778, 15779, 18053, 18098, 18099, 18888, 19313, 19777, and 56667.
If you want to use port 80 and port 443, submit a ticket.
8443
mux
String
No
Specifies whether to enable the multiplexing feature for ports. Valid values:
on
off
off
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "realip", "argValue": "toa" }, { "argName": "port", "argValue": "8443" }, { "argName": "mux", "argValue": "off" }], "functionName": "protogw" }], "DomainNames": "example.com" }
EdgeScript settings
edge_function
Feature description: configures EdgeScript. For more information, see EdgeScript overview.
Feature ID (FunctionID/FuncId): 180.
Request parameters
Parameter
Type
Required
Description
Example
rule
String
Yes
The domain-specific language (DSL) script.
if eq($uri, '/') {\n rewrite('https://example.com/index.html', 'redirect')\n}
pri
Integer
Yes
The priority. Valid values: 0 to 999. A smaller value indicates a higher priority.
NoteThe priorities of the head and foot execution positions are irrelevant to each other.
0
enable
String
Yes
Specifies whether to enable the script. Valid values:
on
off
on
name
String
Yes
The name of the script. The name can contain only letters and underscores (_).
test
pos
String
No
The position where you want to execute the script. Default value: head. Valid values:
head: The script is executed at the head of the pipeline.
foot: The script is executed at the foot of the pipeline.
head
brk
String
No
Specifies whether to skip other scripts after the current script is executed. Default value: off. Valid values:
on: After the current script is matched, the scripts after the specified position are skipped.
off: If the current script is matched, the system continues to match the request against other scripts.
off
option
String
No
The extension.
None
grammar
String
No
The syntax of the script. Valid values: es2 and js. Default value: es2.
/
jsmode
String
No
The JavaScript execution mode. Default value: bypass. Valid values:
redirect: block mode
bypass: bypass mode
/
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "name", "argValue": "test" }, { "argName": "rule", "argValue": "if eq($uri, '/') {\n rewrite('https://example.com/index.html', 'redirect')\n}" }, { "argName": "pri", "argValue": "0" }, { "argName": "pos", "argValue": "head" }, { "argName": "enable", "argValue": "on" }, { "argName": "brk", "argValue": "off" }, { "argName": "option", "argValue": "" }], "functionName": "edge_function" }], "DomainName": "example.com" }
EdgeRoutine settings
edgeroutine
Feature description: configures EdgeRoutine. For more information, see What is ER?
Feature ID (FunctionID/FuncId): 275.
To use this feature, submit a ticket.
Rules engine settings
condition
Feature description: configures rules in a graphical user interface. You can configure rules to identify user requests that carry different parameters to determine whether a configuration applies to the requests. This is a more flexible and more accurate solution for managing configurations and policies that you set in DCDN.
Feature ID (FunctionID/FuncId): 250.
To use this feature, submit a ticket.
Request parameters
Parameter
Type
Required
Description
Example
rule
Array
Yes
The content of a rule, including the name, status, logic operator, and conditional expression.
Rule content:
{"match":{"logic":"and","criteria":[{"matchType":"clientipVer","matchObject":"CONNECTING_IP","matchOperator":"equals","matchValue":"v6","negate":false}]},"name":"example","status":"enable"}
Fields
Name: example
Status: enable
Logic operator: and
Conditional expression: The protocol that is used by the client is IPv6.
Examples:
{ "Functions": [{ "functionArgs": [{ "argName": "rule", "argValue": "{ "match":{ "logic":"and", "criteria":[ { "matchType":"clientipVer", "matchObject":"CONNECTING_IP", "matchOperator":"equals", "matchValue":"v6", "negate":false } ] }, "name":"example", "status":"enable" }" }], "functionName": "condition" }], "DomainNames": "example.com" }
QUIC
quic
Feature description: configures QUIC.
Feature ID (FunctionID/FuncId): 281.
To use this feature, submit a ticket.