Feature settings for domain names

Updated at:

Call the BatchSetVodDomainConfigs operation to configure features for multiple domain names at a time. The following sections list the available features and the parameters for each feature.

Note

These features can be referenced when you call the following API operations: BatchSetVodDomainConfigs and DescribeVodDomainConfigs.

Basic settings

ipv6

  • Description: Configures IPv6 access.

  • Function ID: 194

  • Parameters:

Parameter

Type

Required

Description

Example

switch

String

Yes

Specifies whether to enable IPv6 access. Valid values: on, off.

on

region

String

Yes

The region where IPv6 is enabled. Use an asterisk (*) for all regions.

*

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "switch",
            "argValue": "on"
        }, {
            "argName": "region",
            "argValue": "*"
        }],
        "functionName": "ipv6"
    }],
    "DomainNames": "example.com"
}

Back-to-origin settings

set_req_host_header

  • Description: Configures the default origin host.

  • Function ID: 18

  • Parameters:

Parameter

Type

Required

Description

Example

domain_name

String

Yes

The origin host header content.

example.com

  • Example:

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

forward_scheme

  • Description: Configures the origin protocol.

  • Function ID: 47

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable the origin protocol feature. Valid values: on, off.

on

scheme_origin

String

No

The protocol scheme for origin fetch. Valid values: http, https, follow. Default value: follow.

follow

scheme_origin_port

String

No

Custom origin ports. Required when scheme_origin is set to follow (format: httpPort:httpsPort, for example, 80:443).

80:443

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }, {
            "argName": "scheme_origin",
            "argValue": "follow"
        }, {
            "argName": "scheme_origin_port",
            "argValue": "80:443"
        }],
        "functionName": "forward_scheme"
    }],
    "DomainNames": "example.com"
}

l2_oss_key

  • Description: Configures private OSS Bucket origin fetch. When using this feature for the first time, you must enable the default permission policy, which grants CDN read-only access to all OSS Buckets under the same Alibaba Cloud account.

  • Function ID: 85

  • Parameters:

Parameter

Type

Required

Description

Example

private_oss_auth

String

Yes

Specifies whether to enable private OSS Bucket origin fetch. Valid values: on, off. When enabled, the system automatically configures STS security tokens. This only supports CDN domain origin fetch to OSS private Buckets under the same Alibaba Cloud account.

on

perm_private_oss_tbl

String

No

Permanent security token configuration. Format: access_id=123 access_secret=123abc (separated by space). When configured, CDN domain origin fetch to OSS private Buckets under other Alibaba Cloud accounts is also supported.

access_id=123 access_secret=123abc

  • Example:

{
    "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"
}

https_origin_sni

  • Description: Configures the origin SNI (Server Name Indication).

  • Function ID: 114

  • 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 carried in origin requests (the origin server address that the request needs to access).

origin.example.com

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "https_origin_sni",
            "argValue": "origin.example.com"
        }, {
            "argName": "enabled",
            "argValue": "on"
        }],
        "functionName": "https_origin_sni"
    }],
    "DomainNames": "example.com"
}

forward_timeout

  • Description: Configures the origin request timeout.

  • Function ID: 124

  • Parameters:

Parameter

Type

Required

Description

Example

forward_timeout

Integer

Yes

Request timeout in seconds. We recommend setting a value less than 100 seconds.

30

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "forward_timeout",
            "argValue": "30"
        }],
        "functionName": "forward_timeout"
    }],
    "DomainNames": "example.com"
}

advanced_origin

  • Description: Configures advanced origin fetch, which routes requests to different origin servers based on variables in the user request (such as URI, headers, query parameters, or cookies).

  • Function ID: 235

  • Conflict: Conflicts with origin_dns_host (Function ID: 212). Only one can be configured. If one feature is already configured (including when its switch parameter is set to off), you must delete the existing configuration before configuring the other.

  • Parameters:

Parameter

Type

Required

Description

Example

variable_type

String

Yes

The variable type. Valid values: header (request header), arg (query string parameter), uri (request path), cookie (request cookie).

uri

variable

String

Yes

The variable name. When variable_type is set to uri, the variable must be set to uri.

uri

conditions

String

Yes

The condition operator. Valid values: == (equals), != (not equals).

==

value

String

Yes

The variable value to match.

/image

origin

String

Yes

The origin server domain name to use when the variable matches the specified value.

origin.example.com

  • Example:

{
    "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

  • Description: Configures origin 302 redirect following.

  • Function ID: 219

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable origin 302 redirect following. Valid values: on, off.

on

max_tries

Integer

No

Maximum number of 302 redirects to follow. Default value: 2. Valid values: 1-5. The actual maximum number of origin requests is max_tries + 1.

2

retain_args

String

No

Specifies whether to retain original request parameters when following 302 redirects. Valid values: on, off (default).

off

retain_header

String

No

Specifies whether to retain original request headers when following 302 redirects. Valid values: on, off (default).

off

response_header

String

No

The response header name for 302 redirect. Default value: Location.

X-Alicdn-Redirect

retain_host

String

No

Specifies whether to retain the origin host when following 302 redirects. Valid values: on, off (default).

off

modify_host

String

No

Modifies the origin host when following 302 redirects. By default, the origin host is not modified.

example.com

cache

String

No

Specifies whether to cache 302 redirect results for the same URL to improve CDN response performance. Valid values: on, off (default).

off

expired_time

Integer

No

Cache expiration time for 302 redirect results, in seconds. Must be used with the cache parameter. Default value: 3600.

7200

follow_origin_host

String

No

Specifies whether to use the origin server domain name as the origin host (uses the latest origin domain even after primary/standby switching). Valid values: on, off (default).

off

follow_5xx_retry_origin

String

No

Specifies whether to switch to the next available origin server when the current origin responds with a 5xx status code. Valid values: on, off (default).

off

  • Example:

{
    "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"
}

ipv6_origin

  • Description: Configures IPv6 origin fetch.

  • Function ID: 265

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable IPv6 origin fetch. Valid values: on, off. When enabled, CDN uses IPv6 for origin connections when both the CDN node and origin server have available IPv6 addresses.

on

follow

String

Yes

Specifies whether to follow the client IP protocol version for origin fetch. Valid values: on, off. When enabled, CDN follows the client request protocol: IPv6 client requests prefer IPv6 origin servers; IPv4 client requests prefer IPv4 origin servers.

on

ipv6_v4_mix_used

String

No

Specifies whether to enable IPv4/IPv6 round-robin origin fetch. Valid values: on, off. When enabled, IPv6 origin and follow features become ineffective. All requests use round-robin across all origin addresses regardless of client protocol.

off

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }, {
            "argName": "follow",
            "argValue": "on"
        }],
        "functionName": "ipv6_origin"
    }],
    "DomainNames": "example.com"
}

origin_request_header

  • Description: Configures custom origin HTTP request headers (v2). Supports add, delete, modify, and rewrite operations.

  • Function ID: 228

  • Parameters:

Parameter

Type

Required

Description

Example

header_operation_type

String

Yes

The header operation type. Valid values: add, delete, modify, rewrite.

add

header_name

String

Yes

The request header name.

Accept-Encoding

header_value

String

No

The request header value. Multiple values can be separated by commas (,).

gzip

duplicate

String

No

Specifies whether to allow duplicate headers with the same name (when using the add operation). Valid values: on, off.

off

header_source

String

No

The value to search for replacement (when using the rewrite operation). Supports regular expressions.

value1

header_destination

String

No

The replacement value (when using the rewrite operation).

value123

match_all

String

No

The matching mode (when using the rewrite operation). Valid values: on (replace all matches), off (replace first match only).

off

  • Example:

{
    "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

  • Description: Configures origin HTTP response headers. Supports add, delete, modify, and rewrite operations.

  • Function ID: 229

  • Parameters:

Parameter

Type

Required

Description

Example

header_operation_type

String

Yes

The response header operation type. Valid values: add, delete, modify, rewrite.

add

header_name

String

Yes

The response header name.

Cache-Control

header_value

String

No

The response header value. Multiple values can be separated by commas (,).

no-cache

duplicate

String

No

Specifies whether to allow duplicate headers with the same name (when using the add operation). Valid values: on, off.

off

header_source

String

No

The value to search for replacement (when using the rewrite operation). Supports regular expressions.

value1

header_destination

String

No

The replacement value (when using the rewrite operation).

value123

match_all

String

No

The matching mode (when using the rewrite operation). Valid values: on (replace all matches), off (replace first match only).

off

  • Example:

{
    "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

  • Description: Configures origin URI rewriting.

  • Function ID: 225

  • Parameters:

Parameter

Type

Required

Description

Example

source_url

String

Yes

The URI to be rewritten.

^/hello$

target_url

String

Yes

The target URI after rewriting.

/hello/test

flag

String

No

The execution rule for the rewrite operation. Valid values: (empty, default) continues to match subsequent rewrite rules after execution; break: stops matching subsequent rules after execution; enhance_break: similar to break but processes parameters together and also works for FLV live streaming.

break

sequence

Integer

No

Sets the execution priority of the configuration. Valid values: 1 to 99. A smaller value indicates a higher priority. If this parameter is not specified, priorities are automatically assigned in ascending order starting from 1.

1

  • Example:

{
    "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"
}

Cache settings

filetype_based_ttl_set

  • Description: Configures file expiration time.

  • Function ID: 6

  • Parameters:

Parameter

Type

Required

Description

Example

ttl

Integer

Yes

Cache duration in seconds. Valid values: 1-99999999.

500000

file_type

String

Yes

File types, separated by commas (,). Case-sensitive. For example, jpg,txt.

jpg

weight

Integer

No

Priority. Valid values: 1-99. Default value: 1 (higher value = higher priority).

1

swift_origin_cache_high

String

No

Specifies whether to prioritize the origin cache policy. When enabled, the cache policy from origin response headers (such as Cache-Control and Pragma) takes priority. Valid values: on, off (default).

off

swift_no_cache_low

String

No

Specifies whether to ignore origin no-cache response headers. When enabled, the following origin response headers are ignored: Cache-Control: no-store, Cache-Control: no-cache, Cache-Control: max-age=0, Pragma: no-cache. Valid values: on, off (default).

off

swift_follow_cachetime

String

No

Specifies whether the client follows the CDN cache policy. When enabled, the final effective CDN cache policy is sent in the response to the client. Valid values: on, off (default).

off

force_revalidate

String

No

Specifies whether to force content validation when the TTL is 0. Valid values: on (when TTL is 0, content is cached on the CDN node and revalidated with the origin on each request), off (default, when TTL is 0, content is not cached and is fetched from the origin on each request).

off

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "ttl",
            "argValue": "500000"
        }, {
            "argName": "file_type",
            "argValue": "jpg"
        }],
        "functionName": "filetype_based_ttl_set"
    }],
    "DomainNames": "example.com"
}

path_based_ttl_set

  • Description: Configures directory-based cache expiration time.

  • Function ID: 7

  • Parameters:

Parameter

Type

Required

Description

Example

ttl

Integer

Yes

Cache duration in seconds. Valid values: 1-99999999.

500000

path

String

Yes

The directory path, which must start with a forward slash (/).

/example/demo

weight

Integer

No

Priority. Valid values: 1-99. Default value: 1 (higher value = higher priority).

1

swift_origin_cache_high

String

No

Specifies whether to prioritize the origin cache policy. Valid values: on, off (default).

off

swift_no_cache_low

String

No

Specifies whether to ignore origin no-cache response headers. Valid values: on, off (default).

off

swift_follow_cachetime

String

No

Specifies whether the client follows the CDN cache policy. Valid values: on, off (default).

off

force_revalidate

String

No

Specifies whether to force content validation when the TTL is 0. Valid values: on, off (default).

off

  • Example:

{
    "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

  • Description: Configures file type-based status code cache expiration time.

  • Function ID: 63

  • Parameters:

Parameter

Type

Required

Description

Example

file_type

String

Yes

File types, case-sensitive, separated by commas (,).

jpg

code_string

String

Yes

Status codes and their cache durations in seconds (1-99999999), separated by commas. Format: code=ttl.

403=10

swift_code_origin_cache_high

String

No

Specifies whether to prioritize the origin cache policy. Valid values: on, off (default).

off

swift_code_no_cache_low

String

No

Specifies whether to ignore origin no-cache response headers. Valid values: on, off (default).

off

swift_code_follow_cachetime

String

No

Specifies whether the client follows the CDN cache policy. Valid values: on, off (default).

off

force_revalidate

String

No

Specifies whether to force content validation when the TTL is 0. Valid values: on, off (default).

off

  • Example:

{
    "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

  • Description: Configures path-based status code cache expiration time.

  • Function ID: 65

  • Parameters:

Parameter

Type

Required

Description

Example

path

String

Yes

The directory path, which must start with a forward slash (/).

/example/demo

code_string

String

Yes

Status codes and their cache durations in seconds (1-99999999), separated by commas. Format: code=ttl.

403=10,404=15

swift_code_origin_cache_high

String

No

Specifies whether to prioritize the origin cache policy. Valid values: on, off (default).

off

swift_code_no_cache_low

String

No

Specifies whether to ignore origin no-cache response headers. Valid values: on, off (default).

off

swift_code_follow_cachetime

String

No

Specifies whether the client follows the CDN cache policy. Valid values: on, off (default).

off

force_revalidate

String

No

Specifies whether to force content validation when the TTL is 0. Valid values: on, off (default).

off

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "path",
            "argValue": "/example/demo"
        }, {
            "argName": "code_string",
            "argValue": "403=10,404=15"
        }],
        "functionName": "path_force_ttl_code"
    }],
    "DomainNames": "example.com"
}

set_resp_header

  • Description: Configures custom HTTP response headers.

  • Function ID: 27

  • Parameters:

Parameter

Type

Required

Description

Example

key

String

Yes

The response header name.

Cache-Control

value

String

Yes

The response header value. Multiple values are separated by commas (,). To delete a header, set the value to null.

no-cache

header_operation_type

String

No

The header operation type. Valid values: add, delete, modify, rewrite.

add

duplicate

String

No

Specifies whether to allow duplicate headers (when using the add operation). Valid values: on, off.

off

header_source

String

No

The value to search for replacement (when using rewrite). Supports regular expressions.

value1

header_destination

String

No

The replacement value (when using rewrite).

value123

match_all

String

No

The matching mode (when using rewrite). Valid values: on (replace all), off (replace first only).

off

access_origin_control

String

No

Specifies whether to enable cross-origin validation. Valid values: on, off.

off

  • Example:

{
    "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

  • Description: Configures custom error pages.

  • Function ID: 15

  • Parameters:

Parameter

Type

Required

Description

Example

error_code

Integer

Yes

The error status code.

404

rewrite_page

String

Yes

The redirect page URL.

http://example.aliyundoc.com/error404.html

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "error_code",
            "argValue": "404"
        }, {
            "argName": "rewrite_page",
            "argValue": "http://example.aliyundoc.com/error404.html"
        }],
        "functionName": "error_page"
    }],
    "DomainNames": "example.com"
}

rewrite_host

  • Description: Configures shared cache (cache key rewrite).

  • Function ID: 54

  • Parameters:

Parameter

Type

Required

Description

Example

share_host

String

Yes

The target domain name that can share cache with the current domain. This does not modify the origin host in user requests. It only uses the share_host value to generate the cache key for cache lookups.

example.com

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "share_host",
            "argValue": "example.com"
        }],
        "functionName": "rewrite_host"
    }],
    "DomainNames": "example.com"
}

HTTPS settings

https_option

  • Description: Configures HTTPS basic parameters.

  • Function ID: 78

  • Parameters:

Parameter

Type

Required

Description

Example

http2

String

No

Specifies whether to enable HTTP/2. Valid values: on, off.

on

ocsp_stapling

String

No

Specifies whether to enable OCSP Stapling. Valid values: on, off.

on

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "http2",
            "argValue": "on"
        }],
        "functionName": "https_option"
    }],
    "DomainNames": "example.com"
}

http_force

  • Description: Configures forced HTTP redirect.

  • Function ID: 45

  • Conflict: Conflicts with https_force (Function ID: 44). Only one can be configured. If one feature is already configured (including when its switch parameter is set to off), you must delete the existing configuration before configuring the other.

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable forced HTTP redirect. Valid values: on, off.

on

http_rewrite

String

No

The redirect method. Valid values: 301 (GET request method unchanged, other methods may change to GET), 308 (request method and body are preserved).

301

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }, {
            "argName": "http_rewrite",
            "argValue": "301"
        }],
        "functionName": "http_force"
    }],
    "DomainNames": "example.com"
}

https_force

  • Description: Configures HTTPS redirect.

  • Function ID: 44

  • Conflict: Conflicts with http_force (Function ID: 45). Only one can be configured.

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable HTTPS redirect. Valid values: on, off.

on

https_rewrite

String

No

Redirect method. Valid values: 301, 308.

301

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }, {
            "argName": "https_rewrite",
            "argValue": "301"
        }],
        "functionName": "https_force"
    }],
    "DomainNames": "example.com"
}

https_tls_version

  • Description: Configures TLS protocol versions.

  • Function ID: 110

  • Parameters:

Parameter

Type

Required

Description

Example

tls10

String

No

Specifies whether to enable TLS 1.0. Valid values: on (default), off.

on

tls11

String

No

Specifies whether to enable TLS 1.1. Valid values: on (default), off.

on

tls12

String

No

Specifies whether to enable TLS 1.2. Valid values: on (default), off.

on

tls13

String

No

Specifies whether to enable TLS 1.3. Valid values: on (default), off.

on

ciphersuitegroup

String

No

The cipher suite group. Valid values: all (default, all cipher suites), strict (strong cipher suites only), custom (custom cipher suites).

all

ciphersuite

String

No

Custom cipher suites. Used with ciphersuitegroup set to custom. Multiple cipher suites are separated by commas.

TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "tls10",
            "argValue": "on"
        }, {
            "argName": "tls11",
            "argValue": "on"
        }, {
            "argName": "tls12",
            "argValue": "on"
        }, {
            "argName": "tls13",
            "argValue": "off"
        }, {
            "argName": "ciphersuitegroup",
            "argValue": "all"
        }],
        "functionName": "https_tls_version"
    }],
    "DomainNames": "example.com"
}

Access control settings

referer_white_list_set

  • Description: Configures a Referer whitelist.

  • Function ID: 1

  • Conflict: Conflicts with referer_black_list_set (Function ID: 5). Only one can be configured.

  • Parameters:

Parameter

Type

Required

Description

Example

refer_domain_allow_list

String

Yes

The whitelist of Referer domains, separated by commas (,).

example.aliyundoc.com,demo.aliyundoc.com

allow_empty

String

No

Specifies whether to allow empty Referer fields. Valid values: on, off (default).

off

redirect_url

String

No

The redirect URL for unmatched requests (must start with http:// or https://).

http://www.example.com

disable_ast

String

No

Exact matching mode. Valid values: on (exact match), off (suffix match, default).

off

ignore_scheme

String

No

Specifies whether to ignore the HTTP or HTTPS scheme in the Referer. Valid values: on, off (default).

off

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "refer_domain_allow_list",
            "argValue": "example.aliyundoc.com,demo.aliyundoc.com"
        }],
        "functionName": "referer_white_list_set"
    }],
    "DomainNames": "example.com"
}

referer_black_list_set

  • Description: Configures a Referer blacklist.

  • Function ID: 5

  • Conflict: Conflicts with referer_white_list_set (Function ID: 1). Only one can be configured.

  • Parameters:

Parameter

Type

Required

Description

Example

refer_domain_deny_list

String

Yes

The blacklist of Referer domains, separated by commas (,).

example.aliyundoc.com,demo.aliyundoc.com

allow_empty

String

No

Specifies whether to allow empty Referer fields. Valid values: on, off.

off

redirect_url

String

No

The redirect URL for matched requests.

http://www.example.com

disable_ast

String

No

Exact matching mode. Valid values: on (exact match), off (suffix match, default).

off

ignore_scheme

String

No

Specifies whether to ignore the HTTP or HTTPS scheme in the Referer. Valid values: on, off (default).

off

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "refer_domain_deny_list",
            "argValue": "example.aliyundoc.com,demo.aliyundoc.com"
        }],
        "functionName": "referer_black_list_set"
    }],
    "DomainNames": "example.com"
}

aliauth

  • Description: Configures URL authentication.

  • Function ID: 25

  • Parameters:

Parameter

Type

Required

Description

Example

auth_m3u8

String

No

Enables m3u8 content rewriting. When enabled, authentication parameters are appended to TS segments in the m3u8 file to prevent TS access authentication failures. Valid values: on (default), off.

on

auth_type

String

Yes

Authentication type. Valid values: no_auth, type_a, type_b, type_c, type_d, type_e, type_f. For details about each type, see the URL authentication documentation.

type_a

auth_key1

String

Yes

Authentication key 1 (16-128 characters, letters and digits only).

1234567890123456789

auth_key2

String

No

Authentication key 2 (16-128 characters, letters and digits only).

1234567890123456789

ali_auth_delta

Integer

No

Valid duration of the authenticated URL, in seconds. Default value: 1800.

1800

req_auth_ip_white

String

No

Whitelist IP addresses that are exempt from authentication. Separate multiple IP addresses with commas (,).

192.168.0.1

req_auth_ip_acl_xfwd

String

No

The method to extract the client IP for whitelist exemption. Valid values: on (default, uses the first IP from the X-Forwarded-For header), off (uses the TCP connection IP), all (uses both).

all

sign_param

String

No

The name of the sign parameter. Only valid when auth_type is set to type_f.

sign

time_param

String

No

The name of the timestamp parameter. Only valid when auth_type is set to type_f.

time

time_format

String

No

The format of the timestamp. Only valid when auth_type is set to type_f. Valid values: dec (decimal), hex (hexadecimal).

hex

path_encoding

String

No

Specifies whether to enable URL encoding. Only valid when auth_type is set to type_f. Valid values: on, off.

on

  • Example 1 (Authentication type A):

{
    "Functions": [{
        "functionArgs": [{
            "argName": "auth_type",
            "argValue": "type_a"
        }, {
            "argName": "auth_key1",
            "argValue": "1234567890123456789"
        }, {
            "argName": "auth_key2",
            "argValue": "1234567890123456789"
        }, {
            "argName": "ali_auth_delta",
            "argValue": 1800
        }, {
            "argName": "req_auth_ip_white",
            "argValue": "192.168.0.1"
        }, {
            "argName": "req_auth_ip_acl_xfwd",
            "argValue": "all"
        }],
        "functionName": "aliauth"
    }],
    "DomainNames": "example.com"
}
  • Example 2 (Authentication type F):

{
    "Functions": [{
        "functionArgs": [{
            "argName": "auth_type",
            "argValue": "type_f"
        }, {
            "argName": "auth_key1",
            "argValue": "1234567890123456789"
        }, {
            "argName": "auth_key2",
            "argValue": "1234567890123456789"
        }, {
            "argName": "ali_auth_delta",
            "argValue": 1800
        }, {
            "argName": "sign_param",
            "argValue": "sign"
        }, {
            "argName": "time_param",
            "argValue": "time"
        }, {
            "argName": "time_format",
            "argValue": "hex"
        }, {
            "argName": "path_encoding",
            "argValue": "on"
        }],
        "functionName": "aliauth"
    }],
    "DomainNames": "example.com"
}

cdn_remote_auth

  • Description: Configures remote authentication.

  • Function ID: 258

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable remote authentication. Valid values: on, off.

on

remote_auth_addr

String

Yes

The authentication server address. Format: https://cdn.aliyun.com/auth or http://10.10.10.10/auth.

https://example.aliyundoc.com/auth

remote_auth_method

String

Yes

The request method. Valid values: GET, POST, HEAD.

get

remote_auth_type

String

Yes

The file type to authenticate. Set to all for all types. Multiple types are separated by pipes (|), case-sensitive.

all

remote_auth_reserve_args

String

Yes

Reserved request parameters, separated by pipes (|), case-insensitive. Set to all to reserve all parameters, or ali_delete_all_args to delete all URL parameters.

all

remote_auth_custom_args

String

No

Custom parameters to add, separated by pipes (|), case-sensitive.

(empty)

remote_auth_reserve_header

String

Yes

Reserved request headers, separated by pipes (|), case-insensitive. Set to all to reserve all headers, or ali_delete_all_headers to delete all headers.

all

remote_auth_custom_header

String

No

Custom request headers to add, separated by pipes (|), case-insensitive.

(empty)

remote_auth_success_code

Integer

Yes

The authentication success status code returned by the authentication server. Multiple codes are separated by commas.

200

remote_auth_fail_code

Integer

Yes

The authentication failure status code returned by the authentication server. Multiple codes are separated by commas.

403,404

remote_auth_other_code_act

String

No

The action for other status codes (neither success nor failure). Valid values: pass (default, allow the request), reject (deny the request).

pass

remote_auth_fail_resp_code

Integer

Yes

The status code that CDN returns to the client when authentication fails.

403

remote_auth_timeout

Integer

Yes

The authentication timeout in milliseconds. Maximum value: 3000.

500

remote_auth_timeout_action

String

Yes

The action when authentication times out. Valid values: pass (allow the request), reject (return the failure response code).

pass

  • Example:

{
    "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_reserve_header",
            "argValue": "all"
        }, {
            "argName": "remote_auth_success_code",
            "argValue": "200"
        }, {
            "argName": "remote_auth_fail_code",
            "argValue": "403"
        }, {
            "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

  • Description: Configures an IP whitelist.

  • Function ID: 69

  • Conflict: Conflicts with ip_black_list_set (Function ID: 13). Only one can be configured.

  • Parameters:

Parameter

Type

Required

Description

Example

ip_list

String

Yes

The list of IP addresses or CIDR blocks, separated by commas (,). You can configure up to 700 IPv6 addresses or 2,000 IPv4 addresses. The total string length of the IP addresses cannot exceed 30 KB. CIDR blocks are supported (for example, 127.0.0.0/24). Case is not significant in IPv6 addresses. The :: shorthand is not supported.

192.168.0.1/24

customize_response_status_code

String

No

Custom response status code. Default value: 403.

429

ip_acl_xfwd

String

No

The IP matching mode. Valid values: on (use X-Forwarded-For header, default), off (use TCP connection IP), all (use both).

all

ip_list_notes

String

No

Notes for the IP list.

192.x.x.1 (malicious IP)

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "ip_list",
            "argValue": "192.168.0.1/24"
        }],
        "functionName": "ip_allow_list_set"
    }],
    "DomainNames": "example.com"
}

ip_black_list_set

  • Description: Configures an IP blacklist.

  • Function ID: 13

  • Conflict: Conflicts with ip_allow_list_set (Function ID: 69). Only one can be configured.

  • Parameters:

Parameter

Type

Required

Description

Example

ip_list

String

Yes

The list of IP addresses or CIDR blocks, separated by commas (,). You can configure up to 700 IPv6 addresses or 2,000 IPv4 addresses. The total string length of the IP addresses cannot exceed 30 KB. CIDR blocks are supported (for example, 127.0.0.0/24). Case is not significant in IPv6 addresses. The :: shorthand is not supported.

192.168.0.1

customize_response_status_code

String

No

Custom response status code. Default value: 403.

429

ip_acl_xfwd

String

No

The IP matching mode. Valid values: on (use X-Forwarded-For header, default), off (use TCP connection IP), all (use both).

all

ip_list_notes

String

No

Notes for the IP list.

192.x.x.1 (malicious IP)

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "ip_list",
            "argValue": "192.168.0.1"
        }],
        "functionName": "ip_black_list_set"
    }],
    "DomainNames": "example.com"
}

ali_ua

  • Description: Configures User-Agent access restrictions.

  • Function ID: 58

  • Parameters:

Parameter

Type

Required

Description

Example

ua

String

Yes

User-Agent values. Supports wildcard * (matches any string) and multiple values separated by pipes (|).

*curl*|*IE*|*chrome*|*firefox*

type

String

Yes

The list type. Valid values: black (blacklist), white (whitelist). Blacklist and whitelist are mutually exclusive; only one can be active at a time.

black

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "ua",
            "argValue": "*curl*|*IE*|*chrome*|*firefox*"
        }, {
            "argName": "type",
            "argValue": "black"
        }],
        "functionName": "ali_ua"
    }],
    "DomainNames": "example.com"
}

EdgeScript settings

edge_function

  • Description: Configures EdgeScript rules.

  • Function ID: 180

  • Parameters:

Parameter

Type

Required

Description

Example

rule

String

Yes

DSL rule.

if eq($uri, '/') { rewrite('https://example.com/index.html', 'redirect') }

pri

Integer

Yes

Priority. Valid values: 0-999 (lower value = higher priority). The priorities of head and foot execution positions are independent.

0

enable

String

Yes

Specifies whether the rule is effective. Valid values: on, off.

on

name

String

Yes

Rule name (letters and underscores only).

test

pos

String

No

Execution position. Valid values: head (default, intercept at the beginning of request processing), foot (intercept at the end of request processing).

head

brk

String

No

Specifies whether to break execution. Valid values: on (skip remaining rules at the current execution position after this rule is matched), off (default, continue executing remaining rules).

off

option

String

No

Extension field.

(empty)

grammar

String

No

Rule syntax. Valid values: es2 (default), js.

es2

jsmode

String

No

JS execution mode. Valid values: redirect (intercept mode), bypass (default, bypass mode).

bypass

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "rule",
            "argValue": "if eq($uri, '/') { rewrite('https://example.com/index.html', 'redirect') }"
        }, {
            "argName": "pri",
            "argValue": "0"
        }, {
            "argName": "enable",
            "argValue": "on"
        }, {
            "argName": "name",
            "argValue": "test"
        }],
        "functionName": "edge_function"
    }],
    "DomainNames": "example.com"
}

Performance improvements

set_hashkey_args

  • Description: Configures URL parameter filtering (retain mode).

  • Function ID: 19

  • Conflict: Conflicts with ali_remove_args (Function ID: 75). Only one can be configured.

  • Parameters:

Parameter

Type

Required

Description

Example

hashkey_args

String

No

The list of parameters to retain, separated by commas (,). Maximum: 10 parameters.

key1,key2

disable

String

Yes

Specifies whether to ignore all parameters. Valid values: on (ignore all, only the add operation remains effective), off (default). Ignoring all parameters has lower priority than the retain parameter list.

on

keep_oss_args

String

Yes

Specifies whether to retain parameters for origin requests. Valid values: on (retain all parameters), off (origin parameters match the cache key parameters).

on

  • Example:

{
    "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

  • Description: Configures URL parameter filtering (delete mode).

  • Function ID: 75

  • Conflict: Conflicts with set_hashkey_args (Function ID: 19). Only one can be configured.

  • Parameters:

Parameter

Type

Required

Description

Example

ali_remove_args

String

Yes

The parameters to delete, separated by spaces. Remaining parameters are used as the URL args portion of the cache key.

test

keep_oss_args

String

Yes

Specifies whether to retain parameters for origin requests. Valid values: on (retain all parameters), off (origin parameters match the cache key parameters).

off

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "ali_remove_args",
            "argValue": "test"
        }, {
            "argName": "keep_oss_args",
            "argValue": "off"
        }],
        "functionName": "ali_remove_args"
    }],
    "DomainNames": "example.com"
}

image_transform

  • Description: Configures CDN image transformation.

  • Function ID: 239

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable image transformation. Valid values: on, off.

on

filetype

String

Yes

Supported image formats for transcoding, separated by pipes (|). Valid values: JPEG, JPG, PNG, WEBP, BMP, GIF, TIFF, JP2.

jpg|jpeg|png

webp

String

No

Specifies whether to enable adaptive WebP conversion. Valid values: on, off.

on

orient

String

No

Specifies whether to enable automatic image rotation. Valid values: on, off. Only applies to images with rotation attributes.

on

slim

Integer

No

Image slimming percentage. Valid values: 0-100. Reduces image quality without changing resolution, size, or format to save bandwidth.

10

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "filetype",
            "argValue": "jpg|jpeg|png"
        }, {
            "argName": "webp",
            "argValue": "on"
        }, {
            "argName": "orient",
            "argValue": "on"
        }, {
            "argName": "enable",
            "argValue": "on"
        }],
        "functionName": "image_transform"
    }],
    "DomainNames": "example.com"
}

Video-related settings

range

  • Description: Configures Range-based origin fetch.

  • Function ID: 31

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable Range-based origin fetch. Valid values: on, off, force (force enable).

on

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }],
        "functionName": "range"
    }],
    "DomainNames": "example.com"
}

video_seek

  • Description: Configures video seeking (drag and play).

  • Function ID: 30

  • 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 FLV time-based seeking. Valid values: on, off.

on

mp4_seek_start

String

No

Custom MP4 start parameter name.

mp4starttime

mp4_seek_end

String

No

Custom MP4 end parameter name.

mp4endtime

flv_seek_start

String

No

Custom FLV start parameter name.

flvstarttime

flv_seek_end

String

No

Custom FLV end parameter name.

flvendtime

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }],
        "functionName": "video_seek"
    }],
    "DomainNames": "example.com"
}

ali_video_split

  • Description: Configures audio extraction from video.

  • Function ID: 204

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable audio extraction. Valid values: on, off.

on

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }],
        "functionName": "ali_video_split"
    }],
    "DomainNames": "example.com"
}

ali_video_preview

  • Description: Configures video preview (trial viewing).

  • Function ID: 205

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable video preview. Valid values: on, off. Supports TS and MP3 file formats. For FLV and MP4, use the video seeking feature.

on

ali_video_preview_argument

String

Yes

The custom preview parameter name. The parameter value unit must be in seconds.

fds

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }, {
            "argName": "ali_video_preview_argument",
            "argValue": "fds"
        }],
        "functionName": "ali_video_preview"
    }],
    "DomainNames": "example.com"
}

hls_token_rewrite

  • Description: Configures M3U8 standard encryption rewriting.

  • Function ID: 253

  • Parameters:

Parameter

Type

Required

Description

Example

enable

String

Yes

Specifies whether to enable M3U8 standard encryption rewriting. Valid values: on, off.

on

hls_token_arg_name

String

No

The custom HLS token parameter name. Default value: MtsHlsUriToken.

example

  • Example:

{
    "Functions": [{
        "functionArgs": [{
            "argName": "enable",
            "argValue": "on"
        }],
        "functionName": "hls_token_rewrite"
    }],
    "DomainNames": "example.com"
}