All Products
Search
Document Center

ApsaraVideo VOD:Feature settings for domain names

Last Updated:Jun 11, 2024

You can call the BatchSetVodDomainConfigs operation to configure features for multiple domain names at a time. This topic describes the features that you can configure by calling this operation and parameters that you need to specify when you call this operation.

Note

The features described in this topic can be referenced when you call the following API operations: BatchSetVodDomainConfigs and DescribeVodDomainConfigs.

Basic settings

ipv6

  • Feature description: configures IPv6. For more information, see Configure IPv6.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    switch

    String

    Yes

    Specifies whether to enable IPv6.

    • on

    • off

    on

    region

    String

    Yes

    The region where you want to enable IPv6.

    Note
    • You can enter an asterisk (*) to specify all regions. If you want to enable IPv6 in a specific region, submit a ticket.

    • If you leave this parameter empty, IPv6 is enabled in all regions.

    *

  • Sample code:

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

Back-to-origin settings

set_req_host_header

  • Feature description: configures the default origin host. For more information, see Configure an origin host.

  • The following table describes the 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 origin protocol policy.

  • The following table describes the 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: Alibaba Cloud CDN redirects requests to the origin server over HTTP.

    • https: Alibaba Cloud CDN redirects requests to the origin server over HTTPS.

    • follow: When a client uses HTTP or HTTPS to request resources, Alibaba Cloud CDN redirects the request to the origin server over the protocol that is used by the client.

    Note

    Default 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

  • Sample code:

    {
        "Functions": [{
            "functionArgs": [{
                "argName": "enable",
                "argValue": "on"
            }, {
                "argName": "scheme_origin",
                "argValue": "follow"
            }],
            "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 Enable access to private OSS buckets.

  • The following table describes the 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 a security token issued by Security Token Service (STS). However, Alibaba Cloud CDN can only access 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, Alibaba Cloud CDN 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"
    }

https_origin_sni

  • Feature description: configures origin Server Name Indication (SNI). For more information, see Configure origin SNI.

  • The following table describes the 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 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 timeout period for a back-to-origin request. For more information, see Configure a timeout period for back-to-origin HTTP requests.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    forward_timeout

    Integer

    Yes

    The timeout period for the request. Unit: seconds.

    Note

    We 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 back-to-origin routing settings. For more information, see Configure advanced origin settings.

  • The following table describes the 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.

    Note

    If 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. For more information, see Configure 301/302 redirection.

  • The following table describes the 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.

    Note

    Number 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

    response_header

    String

    No

    The response header of 302 redirects that is returned from the origin server. Default value: Location.

    X-Alicdn-Redirect

    retain_host

    String

    No

    Specifies whether to retain the origin domain name during 302 redirects. This feature is available only when the destination domain name is obtained from the response header. Default value: off. Valid values:

    • on

    • off

    off

    modify_host

    String

    No

    Specifies whether to modify the origin domain name during 302 redirects. This feature is available only when the destination domain name is obtained from the response header. By default, the origin domain name is not modified.

    example.com

    cache

    String

    No

    Specifies whether to cache the redirection results of the same URL during 302 redirects. This can help improve the response performance of Alibaba Cloud CDN. Default value: off. Valid values:

    • on

    • off

    off

    expired_time

    Integer

    No

    The timeout period for the cached redirection results of the same URL during 302 redirects. This parameter is valid when the cache parameter is set to on. Unit: seconds. Default value: 3600.

    7200

    follow_origin_host

    String

    No

    Specifies whether the origin domain name is used as the origin host during 302 redirects. If this parameter is set to on, the origin domain name is used as the origin host and the most recent origin domain name is used for a primary/secondary switchover. Default value: off. Valid values:

    • on

    • off

    off

    follow_5xx_retry_origin

    String

    No

    Specifies whether to enable a primary/secondary origin switchover. If this feature is enabled, when Alibaba Cloud CDN receives an HTTP 5xx status code from an origin server, Alibaba Cloud CDN switches to the next available origin server. 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"
    }, {
                "argName": "response_header",
                "argValue": "X-Alicdn-Redirect"
    }, {
                "argName": "retain_header",
                "argValue": "off"
    }, {
                "argName": "modify_host",
                "argValue": "example.com"
    }, {
                "argName": "cache",
                "argValue": "off"
    }, {
                "argName": "expired_time",
                "argValue": "7200"
    }, {
                "argName": "follow_origin_host",
                "argValue": "off"
    }, {
                "argName": "follow_5xx_retry_origin",
                "argValue": "off"
            }],
            "functionName": "follow_302"
        }],
        "DomainNames": "example.com"
    }

ipv6_origin

  • Feature description: configures back-to-origin routing over IPv6. For more information, see Configure back-to-origin routing over IPv6.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    enable

    String

    Yes

    Specifies whether to enable origin fetch over IPv6.

    • on

    • off

    Note

    After 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

    Note

    After 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/IPv6 polling feature.

    • on

    • off

    Note
    • This 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"
    }

origin_request_header

  • Feature description: configures an origin HTTP request header. For more information, see Configure HTTP request headers.

  • The following table describes the 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 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. Valid values:

    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. For more information, see Configure HTTP response headers.

  • The following table describes the 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 one or more values for a response header. Separate 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 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. Valid values:

    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 URLs in back-to-origin requests. For more information, see Rewrite URLs in back-to-origin requests.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    source_url

    String

    Yes

    The URL that you want to rewrite.

    ^/hello$

    target_url

    String

    Yes

    The final URL.

    /hello/test

    flag

    String

    No

    The rewrite flag. Valid values:

    • None: If the current rule is matched, the system continues to match the URL against other rules.

    • break: If the current rule is matched, the system skips other rules.

    • enhance_break: This flag is similar to break but 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",
    }

Cache settings

filetype_based_ttl_set

  • Feature description: configures a time-to-live (TTL) for files. For more information, see Cache settings.

  • The following table describes the 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.

    Note

    Default value: 1. A higher value indicates a higher priority.

    1

    swift_origin_cache_high

    String

    No

    Specifies whether cache policies on origin servers prevail when origin servers respond to cache-related headers, such as Cache-Control and Pragma. Default value: off. Default value: off. Valid values:

    • on

    • off

    off

    swift_no_cache_low

    String

    No

    Specifies whether to ignore the following response headers from origin servers. If this parameter is set to on, resources are not cached.

    • Cache-Control: no-store

    • Cache-Control: no-cache

    • Cache-Control: max-age=0

    • Pragme: no-cache

    Default value: off. Valid values:

    • on

    • off

    off

    swift_follow_cachetime

    String

    No

    Specifies whether the client uses the cache policy that is used by Alibaba Cloud CDN. Default value: off. Valid values:

    • on

    • off

    off

  • Examples:

    {
        "Functions": [{
            "functionArgs": [{
                "argName": "file_type",
                "argValue": "jpg"
            }, {
                "argName": "weight",
                "argValue": "1"
            }, {
                "argName": "ttl",
                "argValue": "500000"
            }, {
                "argName": "swift_origin_cache_high",
                "argValue": "off"
            }, {
                "argName": "swift_no_cache_low",
                "argValue": "off"
            }, {
                "argName": "swift_follow_cachetime",
                "argValue": "off"
            }],
            "functionName": "filetype_based_ttl_set"
        }],
        "DomainNames": "example.com"
    }
    

path_based_ttl_set

  • Feature description: configures a TTL for directories. For more information, see Cache settings.

  • The following table describes the 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.

    Note

    Default value: 1. A higher value indicates a higher priority.

    1

    swift_origin_cache_high

    String

    No

    Specifies whether cache policies on origin servers prevail when origin servers respond to cache-related headers, such as Cache-Control and Pragma. Default value: off. Default value: off. Valid values:

    • on

    • off

    off

    swift_no_cache_low

    String

    No

    Specifies whether to ignore the following response headers from origin servers. If this parameter is set to on, resources are not cached.

    • Cache-Control: no-store

    • Cache-Control: no-cache

    • Cache-Control: max-age=0

    • Pragme: no-cache

    Default value: off. Valid values:

    • on

    • off

    off

    swift_follow_cachetime

    String

    No

    Specifies whether the client uses the cache policy that is used by Alibaba Cloud CDN. Default value: off. Valid values:

    • on

    • off

    off

  • Examples:

    {
        "Functions": [{
            "functionArgs": [{
                "argName": "path",
                "argValue": "/example/demo"
            }, {
                "argName": "weight",
                "argValue": "1"
            }, {
                "argName": "ttl",
                "argValue": "500000"
            }, {
                "argName": "swift_origin_cache_high",
                "argValue": "off"
            }, {
                "argName": "swift_no_cache_low",
                "argValue": "off"
            }, {
                "argName": "swift_follow_cachetime",
                "argValue": "off"
            }],
            "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 Configure the validity period for status codes.

  • The following table describes the 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. 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

    swift_origin_cache_high

    String

    No

    Specifies whether cache policies on origin servers prevail when origin servers respond to cache-related headers, such as Cache-Control and Pragma. Default value: off. Default value: off. Valid values:

    • on

    • off

    off

    swift_no_cache_low

    String

    No

    Specifies whether to ignore the following response headers from origin servers. If this parameter is set to on, resources are not cached.

    • Cache-Control: no-store

    • Cache-Control: no-cache

    • Cache-Control: max-age=0

    • Pragme: no-cache

    Default value: off. Valid values:

    • on

    • off

    off

    swift_follow_cachetime

    String

    No

    Specifies whether the client uses the cache policy that is used by Alibaba Cloud CDN. Default value: off. Valid values:

    • on

    • off

    off

  • Examples:

    {
        "Functions": [{
            "functionArgs": [{
                "argName": "file_type",
                "argValue": "jpg"
            }, {
                "argName": "code_string",
                "argValue": "403=10"
           }, {
                "argName": "swift_origin_cache_high",
                "argValue": "off"
            }, {
                "argName": "swift_no_cache_low",
                "argValue": "off"
            }, {
                "argName": "swift_follow_cachetime",
                "argValue": "off"
            }],
            "functionName": "filetype_force_ttl_code"
        }],
        "DomainNames": "example.com"
    }

path_force_ttl_code

  • Feature description: configures a TTL for HTTP status codes of paths. For more information, see Configure the validity period for status codes.

  • The following table describes the 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

    swift_origin_cache_high

    String

    No

    Specifies whether cache policies on origin servers prevail when origin servers respond to cache-related headers, such as Cache-Control and Pragma. Default value: off. Default value: off. Valid values:

    • on

    • off

    off

    swift_no_cache_low

    String

    No

    Specifies whether to ignore the following response headers from origin servers. If this parameter is set to on, resources are not cached.

    • Cache-Control: no-store

    • Cache-Control: no-cache

    • Cache-Control: max-age=0

    • Pragme: no-cache

    Default value: off. Valid values:

    • on

    • off

    off

    swift_follow_cachetime

    String

    No

    Specifies whether the client uses the cache policy that is used by Alibaba Cloud CDN. Default value: off. Valid values:

    • on

    • off

    off

  • Examples:

    {
        "Functions": [{
            "functionArgs": [{
                "argName": "path",
                "argValue": "/example/demo"
            }, {
                "argName": "code_string",
                "argValue": "403=10,404=15"
            }, {
                "argName": "swift_origin_cache_high",
                "argValue": "off"
            }, {
                "argName": "swift_no_cache_low",
                "argValue": "off"
            }, {
                "argName": "swift_follow_cachetime",
                "argValue": "off"
            }],
            "functionName": "path_force_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.

  • The following table describes the 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 (,).

    Note

    If 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. Valid values:

    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). Valid values:

    • 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 page. For more information, see Customize a page.

  • The following table describes the 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"
    }

rewrite_host

  • Feature description: configures cache sharing.

  • The following table describes the 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. Only HTTP/2 is supported. For more information, see Enable HTTP/2.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    http2

    String

    No

    Specifies whether to enable HTTP/2.

    • on

    • off

    on

  • Sample code:

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

http_force

  • Feature description: configures forcible URL redirection to HTTP. For more information, see Forcible redirect.

    Note
    • The forcible URL redirection to HTTP feature conflicts with the forcible URL redirection to HTTPS feature (function: https_force). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    enable

    String

    Yes

    Specifies whether to enable URL redirection to HTTP.

    • 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 forcible URL redirection to HTTPS. For more information, see Forcible redirect.

    Note
    • The forcible URL redirection to HTTPS feature conflicts with the forcible URL redirection to HTTP feature (function: https_force). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the 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 Transport Layer Security (TLS) version. For more information, see Configure TLS version control.

  • The following table describes the 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

    ciphersuitegroup

    String

    No

    The cipher suite group. Default value: all. Valid values:

    • all: all cipher suites.

    • strict: enhanced cipher suite.

    • custom: custom cipher suite.

    all

    String

    No

    The cipher suites. This parameter is used together with the ciphersuitegroup parameter. Separate multiple cipher suites with commas (,).

    TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

  • Examples:

    • TLS 1.0, 1.1, and 1.2 are enabled and all cipher suites are used. This is the default configuration.

      {
          "Functions": [{
              "functionArgs": [
                  {
                    "ArgValue": "on",
                    "ArgName": "tls10"
                  },
                  {
                    "ArgValue": "on",
                    "ArgName": "tls11"
                  },
                  {
                    "ArgValue": "on",
                    "ArgName": "tls12"
                  },
                  {
                    "ArgValue": "off",
                    "ArgName": "tls13"
                  },
                  {
                    "ArgValue": "all",
                    "ArgName": "ciphersuitegroup"
                  }
                ],
              "functionName": "https_tls_version"
          }],
          "DomainNames": "example.com"
      }
    • TLS 1.2 and 1.3 are enabled and the enhanced cipher suite is used.

      {
          "Functions": [{
              "functionArgs": [
                  {
                    "ArgValue": "off",
                    "ArgName": "tls10"
                  },
                  {
                    "ArgValue": "off",
                    "ArgName": "tls11"
                  },
                  {
                    "ArgValue": "on",
                    "ArgName": "tls12"
                  },
                  {
                    "ArgValue": "on",
                    "ArgName": "tls13"
                  },
                  {
                    "ArgValue": "strict",
                    "ArgName": "ciphersuitegroup"
                  }
                ],
              "functionName": "https_tls_version"
          }],
          "DomainNames": "example.com"
      }
    • TLS 1.2 and 1.3 are enabled and a custom cipher suite is used.

      {
          "Functions": [{
              "functionArgs": [
                  {
                    "ArgValue": "off",
                    "ArgName": "tls10"
                  },
                  {
                    "ArgValue": "off",
                    "ArgName": "tls11"
                  },
                  {
                    "ArgValue": "on",
                    "ArgName": "tls12"
                  },
                  {
                    "ArgValue": "on",
                    "ArgName": "tls13"
                  },
                  {
                    "ArgValue": "custom",
                    "ArgName": "ciphersuitegroup"
                  },
                  {
                    "ArgValue": "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
                    "ArgName": "ciphersuite"
                  }
                ],
              "functionName": "https_tls_version"
          }],
          "DomainNames": "example.com"
      }

Access control settings

referer_white_list_set

  • Feature description: configures a Referer whitelist. For more information, see Hotlink protection.

    Note
    • The Referer whitelist feature conflicts with the Referer blacklist feature (function: referer_black_list_set). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the 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

    Specifies whether requests with an empty Referer header can access resources on Alibaba Cloud CDN POPs. 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

  • Sample code:

    {
      "Functions": [
        {
          "functionArgs": [
            {
              "argName": "allow_empty",
              "argValue": "off"
            },
            {
              "argName": "refer_domain_allow_list",
              "argValue": "example.aliyundoc.com,demo.aliyundoc.com"
            },
            {
              "argName": "disable_ast",
              "argValue": "on"
            },
            {
              "argName": "ignore_scheme",
              "argValue": "on"
            },
            {
              "argName": "redirect_url",
              "argValue": "http://www.example.com"
            }
          ],
          "functionName": "referer_white_list_set"
        }
      ],
      "DomainNames": "example.com"
    }

referer_black_list_set

  • Feature description: configures a Referer blacklist. For more information, see Hotlink protection.

    Note
    • The Referer blacklist feature conflicts with the Referer whitelist feature (function: referer_white_list_set). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the 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

    Specifies whether requests with an empty Referer header can access resources on Alibaba Cloud CDN POPs. Valid values:

    • 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. Sample code:

    • 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

  • Sample code:

    {
      "Functions": [
        {
          "functionArgs": [
            {
              "argName": "allow_empty",
              "argValue": "off"
            },
            {
              "argName": "refer_domain_deny_list",
              "argValue": "example.aliyundoc.com,demo.aliyundoc.com"
            },
            {
              "argName": "disable_ast",
              "argValue": "on"
            },
            {
              "argName": "ignore_scheme",
              "argValue": "on"
            },
            {
              "argName": "redirect_url",
              "argValue": "http://www.example.com"
            }
          ],
          "functionName": "referer_black_list_set"
        }
      ],
      "DomainNames": "example.com"
    }

aliauth

  • Feature description: configures URL signing. For more information, see URL signing.

  • The following table describes the 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 validity period of the encrypted URLs. Unit: seconds. Default value: 1800.

    1800

    req_auth_ip_white

    String

    No

    The IP address whitelist. The IP addresses in the whitelist are not verified for authentication.

    You can enter multiple IP addresses. Separate multiple IP addresses with commas (,).

    192.168.0.1

    req_auth_ip_acl_xfwd

    String

    No

    The IP address verification mode. Valid values:

    • on: This is the default mode. This mode verifies only the client IP address. The client IP address is the first IP address in the XFF header in a client request.

    • off: This mode verifies only the IP address that is used by a client to connect to a POP.

    • all: This mode verifies the following IP addresses:

      • The first IP address in the XFF header, which is the client IP address.

      • The IP address that is used by a client to connect to a POP.

    all

  • 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
            }, {
                "argName": "req_auth_ip_white",
                "argValue": "192.168.0.1"
            }, {
                "argName": "req_auth_ip_acl_xfwd",
                "argValue": "all"
            }],
            "functionName": "aliauth"
        }],
        "domainNames": "example.com"
    }

cdn_remote_auth

  • Feature description: configures remote authentication. For more information, see Remote authentication.

  • The following table describes the 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. Valid formats: https://cdn.aliyun.com/auth and http://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 Alibaba Cloud CDN 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 Alibaba Cloud CDN 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 Alibaba Cloud CDN does not indicate that a request passes or fails authentication. Valid values:

    • pass (default): Alibaba Cloud CDN allows the request.

    • reject: Alibaba Cloud CDN rejects the request.

    pass

    remote_auth_fail_resp_code

    Integer

    Yes

    The HTTP status code that is returned by Alibaba Cloud CDN to users when a request fails authentication. For example, if you set this parameter to 403, Alibaba Cloud CDN returns the HTTP 403 status code to the user when the 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: Alibaba Cloud CDN allows the request.

    • reject: Alibaba Cloud CDN 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 IP address blacklist or whitelist.

    Note
    • The IP address whitelist feature conflicts with the IP address blacklist feature (function: ip_black_list_set). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the 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 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 the IP address that is used to connect to the POP for verification.

    all

  • Sample code:

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

ip_black_list_set

  • Feature description: configures an IP address blacklist. For more information, see IP address blacklist or whitelist.

    Note
    • The IP address blacklist feature conflicts with the IP address whitelist feature (function: ip_allow_list_set). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the 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 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 the IP address that is used to connect to the POP for verification.

    all

  • Sample code:

    {
      "Functions": [
        {
          "functionArgs": [
            {
              "argName": "ip_list",
              "argValue": "192.168.0.1"
            },
            {
              "argName": "ip_acl_xfwd",
              "argValue": "all"
            }
          ],
          "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.

  • The following table describes the 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 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.

    Note

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

EdgeScript settings

edge_function

  • Feature description: configures EdgeScript. For more information, see EdgeScript overview.

  • The following table describes the 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.

    Note

    The 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 matching the request against other scripts.

    off

    option

    String

    No

    The extension.

    No value is specified.

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

Performance improvements

set_hashkey_args

  • Feature description: retains URL parameters. For more information, see Parameter filtering.

    Note
    • The URL parameter retaining feature conflicts with the URL parameter deleting feature (function: ali_remove_args). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the 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.

    Note

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

    Note
    • The URL parameter deleting feature conflicts with the URL parameter retaining feature (function: set_hashkey_args). You can use only one of the two features.

    • If you have configured either feature, you must delete the configuration of the feature before you configure the other feature. You can call the DeleteVodSpecificConfig 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 considered configured.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    ali_remove_args

    String

    Yes

    The parameters that you want to delete. Separate multiple parameters with spaces.

    Note

    The 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 processing. For more information, see Image processing.

  • The following table describes the 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

    Note

    This 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 object chunking. For more information, see Object chunking.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    enable

    String

    Yes

    Specifies whether to enable range origin fetch. Valid values:

    • on: enables range origin fetch.

    • off: disables range origin fetch.

    • 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 Video seeking.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    enable

    String

    Yes

    Specifies whether to enable video seeking. Valid values:

    • on

    • off

    on

  • Sample code:

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

ali_video_split

  • Feature description: configures audio extraction. For more information, see Audio extraction.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    enable

    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. For more information, see Audio and video preview.

  • The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    Example

    enable

    String

    Yes

    Specifies whether to enable video preview.

    • on

    • off

    Note

    The 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. For more information, see Parameter pass-through for HLS encryption.

  • The following table describes the 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",
    }