Help Center/ Content Delivery Network/ API Reference/ API/ Domain Name Configuration/ Modifying the Full Domain Configuration
Updated on 2025-08-19 GMT+08:00

Modifying the Full Domain Configuration

Function

This API is used to modify the domain name configuration. You can modify the service type, service area, remarks, IPv6, origin protocol, origin URL rewriting, advanced origin, range request, redirect from origin, ETag verification, origin response timeout, origin request header, HTTPS, TLS version, force redirect, HSTS, HTTP/2, OCSP stapling, QUIC, cache rule, status code cache TTL, referer validation, IP ACL, User-Agent ACL, token authentication, remote authentication, IP access frequency, HTTP header, custom error page, smart compression, request rate limiting, WebSocket, video seek, origin SNI, access URL rewriting, browser cache TTL, geo-blocking settings, and client certificate settings.

  • A single tenant can call this API 200 times per minute.

Calling Method

For details, see Calling APIs.

URI

PUT /v1.1/cdn/configuration/domains/{domain_name}/configs

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

domain_name

Yes

String

Definition

Acceleration domain name.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Definition

Enterprise project ID. Obtain the enterprise project ID by calling the ListEnterpriseProject API of EPS.

Constraints

This parameter indicates the ID of the enterprise project to which the resource to be queried belongs. It is valid only when the enterprise project function is enabled. The value all indicates all projects.

Range

N/A

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Constraints

N/A

Range

N/A

Default Value

N/A

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

configs

No

Configs object

Definition

Configuration items.

Constraints

N/A

Table 5 Configs

Parameter

Mandatory

Type

Description

business_type

No

String

Definition

Service type.

Constraints

Whole site acceleration cannot be changed to other service types.

Range

  • web: website acceleration.

  • download: file download acceleration.

  • video: on-demand service acceleration.

Default Value

N/A

service_area

No

String

Definition

Service area of the acceleration domain name. Client access requests are scheduled to CDN PoPs in the service area. You can select a proper area based on your user location.

Constraints

  • Currently, the service area cannot be changed between mainland_china and outside_mainland_china.

  • If the service area is changed to mainland_china or global, the domain name must be licensed by the MIIT.

Range

  • mainland_china: Chinese mainland.

  • global: global.

  • outside_mainland_china: outside the Chinese mainland.

Default Value

N/A

remark

No

String

Definition

Domain name remarks.

Constraints

N/A

Range

0 to 10,000 characters.

Default Value

N/A

origin_request_header

No

Array of OriginRequestHeader objects

Definition

Origin request headers. During origin pull, CDN PoPs perform operations on HTTP origin request headers based on your settings.

Constraints

  • Original settings of all headers will be overwritten. When using this API, upload information of all headers.

  • If a special request header is configured for the domain name in the backend, pass this header as well.

http_response_header

No

Array of HttpResponseHeader objects

Definition

HTTP response headers. When CDN PoPs respond to clients, they perform operations on HTTP response headers based on your settings.

Constraints

  • Original settings of all headers will be overwritten. When using this API, upload information of all headers.

  • If a special response header is configured for the domain name in the backend, pass this header as well.

url_auth

No

UrlAuth object

Definition

Token authentication, which protects your website resources from being downloaded by malicious users.

Constraints

N/A

https

No

HttpPutBody object

Definition

Add a certificate on CDN PoPs to allow clients to access PoPs using HTTPS.

Constraints

N/A

sources

No

Array of SourcesConfig objects

Definition

Origin server of the acceleration domain name. CDN caches origin content on PoPs so that your content loads faster.

Constraints

N/A

origin_protocol

No

String

Definition

Request protocol for CDN origin pull.

Constraints

N/A

Range

  • follow: same as user.

  • http: HTTP.

  • https: HTTPS.

Default Value

http

origin_follow302_status

No

String

Definition

Whether to enable redirect from origin. If the origin server uses 301/302 redirection, CDN PoPs redirect to the address specified in a 301/302 response, cache the resource, and return it to the user.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

cache_rules

No

Array of CacheRules objects

Definition

Parameters used to control the cache TTL of origin server resources on CDN PoPs.

Constraints

There must be a rule for all file types.

ip_filter

No

IpFilter object

Definition

IP access control list (ACL), which blocks or allows access from specific IP addresses.

Constraints

N/A

referer

No

RefererConfig object

Definition

Referrer whitelist or whitelist, which identifies and filters user identities to control access.

Constraints

N/A

force_redirect

No

ForceRedirectConfig object

Definition

This parameter is used to force clients to use HTTPS or HTTP when accessing CDN PoPs.

Constraints

N/A

compress

No

Compress object

Definition

Smart compression. CDN can compress static content on websites by reducing file size. This speeds up file transfer and saves a lot of bandwidth.

Constraints

N/A

cache_url_parameter_filter

No

CacheUrlParameterFilter object

Definition

Settings of caching URL parameters.

NOTE:
This old parameter will be deprecated recently. You are advised to use CacheRules.

Constraints

N/A

ipv6_accelerate

No

Integer

Definition

Whether to enable IPv6 to allow clients to access CDN using IPv6.

Constraints

N/A

Range

  • 1: enabled.

  • 0: disabled.

Default Value

N/A

error_code_cache

No

Array of ErrorCodeCache objects

Definition

You can cache error codes returned by the origin server on CDN PoPs. When users request the same resources, CDN directly returns the error codes to the users.

Constraints

N/A

origin_range_status

No

String

Definition

Range requests for origin pull. A range request allows the origin server to send data of a specific range to a CDN PoP based on the range information in the HTTP request header.

Constraints

To enable range requests for origin pull, the origin server must support range requests, that is, requests with the Range field in the headers. Otherwise, origin pull may fail.

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

user_agent_filter

No

UserAgentFilter object

Definition

User-Agent ACL, which filters out requests from specific proxies.

Constraints

N/A

origin_request_url_rewrite

No

Array of OriginRequestUrlRewrite objects

Definition

Origin URL rewrite rules. This ensures that an origin request URL matches the URL of the origin server content.

Constraints

Up to 20 rules.

flexible_origin

No

Array of flexibleOrigins objects

Definition

Advanced origin rules. CDN can pull content from different origin servers by resource type or path.

Constraints

Up to 20 rules.

slice_etag_status

No

String

Definition

Whether to verify the ETag during origin pull. After this function is enabled, when a user requests a cached content from a PoP again, the ETag value is added for determining whether the cache expires.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

origin_receive_timeout

No

Integer

Definition

Timeout interval for CDN PoP origin pull. If this time expires, origin pull fails.

Constraints

N/A

Range

5 to 300, in seconds.

Default Value

N/A

remote_auth

No

commonRemoteAuth object

Definition

Remote authentication. CDN can forward user requests to the authentication server you specify and determine whether to return requested content to users based on the server response.

Constraints

N/A

websocket

No

webSocketSeek object

Definition

Whether to allow clients to access CDN PoPs using WebSocket.

NOTE:
WebSocket works only for resources whose TTL is set to 0, TTL source is set to CDN, and forcible cache is enabled.

Constraints

  • Only domain names for whole site acceleration support this configuration item.

  • WebSocket and HTTP/2 are incompatible and cannot be both enabled.

video_seek

No

videoSeek object

Definition

Video seek settings. Users can seek to any position in a video without affecting the playback effect.

Constraints

  • You have configured a cache rule for FLV and MP4 files and ignored all URL parameters in user requests.

  • Time-based FLV seek is valid only when video seek is enabled.

request_limit_rules

No

Array of RequestLimitRules objects

Definition

Request rate limiting. This limits the user request rate within a specific range to reduce costs and the risk of burst bandwidth.

Constraints

N/A

ip_frequency_limit

No

IpFrequencyLimit object

Definition

IP access frequency. You can limit the number of times that a single IP address accesses a single PoP per second to defend against CC attacks and malicious theft.

NOTE:
When the threshold is reached, CDN returns status code 403. The restriction is removed 10 minutes later.

Constraints

N/A

hsts

No

Hsts object

Definition

HSTS, which forces clients (such as browsers) to use HTTPS to access your server, improving access security.

Constraints

N/A

quic

No

Quic object

Definition

QUIC. Using QUIC to access CDN PoPs improves transmission security, reduces transmission and connection latency, and prevents network congestion.

Constraints

N/A

error_code_redirect_rules

No

Array of ErrorCodeRedirectRules objects

Definition

Custom error page. When an error occurs during user access, CDN returns this error page to clients, optimizing user experience.

Constraints

N/A

sni

No

Sni object

Definition

Origin SNI. If your origin server IP address is bound to multiple domain names and CDN visits the origin server using HTTPS, specify the domain name to be visited by CDN during handshake.

Constraints

N/A

request_url_rewrite

No

Array of RequestUrlRewrite objects

Definition

Access URL rewrite rules, which are used to redirect user requests to the URLs of cached content.

Constraints

N/A

browser_cache_rules

No

Array of BrowserCacheRules objects

Definition

Browser cache TTL, during which users can obtain content directly from their browser cache (if available).

Constraints

N/A

access_area_filter

No

Array of AccessAreaFilter objects

Definition

Geo-blocking, which prevents users in certain geographical locations from accessing your content.

NOTE:
IP addresses belong to carriers and change irregularly. Although Huawei Cloud periodically updates the IP address library, the update may be delayed. As a result, some access control functions may occasionally block or allow requests, or client requests may not be scheduled to the optimal PoP.

Constraints

N/A

client_cert

No

ClientCert object

Definition

Client certificate, which enforces mutual certificate authentication between clients and CDN PoPs, securing website communication.

Constraints

N/A

Table 6 OriginRequestHeader

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Name of an origin request header.

Constraints

N/A

Range

  • Enter 1 to 100 characters.

  • Use only letters, digits, and hyphens (-).

  • Start with a letter.

Default Value

N/A

value

No

String

Definition

Value of the origin request header.

Constraints

N/A

Range

  • Enter 1 to 1,000 characters.

  • Use only letters, digits, and the following special characters: .-_*#!&+|^~'"/:;,=@?<>

  • This parameter is optional when the header is to be deleted.

  • Chinese characters are not allowed.

  • Variables, such as $client_ip and $remote_port, are not allowed.

Default Value

N/A

action

Yes

String

Definition

Operation type of the origin request header.

Constraints

  • A request header field can only be deleted or set.

  • When action is set to set, if the header does not exist in the original origin request, it is added. If it exists, it is modified.

Range

  • delete

  • set

Default Value

N/A

Table 7 HttpResponseHeader

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Name of an HTTP response header.

Constraints

N/A

Range

  • Enter 1 to 100 characters.

  • Use only letters, digits, and hyphens (-). Start with a letter.

Default Value

N/A

value

No

String

Definition

Value of the HTTP response header.

Constraints

N/A

Range

  • Enter 1 to 1,000 characters.

  • Use only letters, digits, and the following special characters: .-_*#!&+|^~'"/:;,=@?<>

  • This parameter is optional when the header is to be deleted.

Default Value

N/A

action

Yes

String

Definition

Operation type of the HTTP response header.

Constraints

  • A response header field can only be deleted or set.

  • When action is set to set, if the header does not exist in the original HTTP response, it is added. If it exists, it is modified.

Range

  • set

  • delete

Default Value

N/A

Table 8 UrlAuth

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

Whether to enable token authentication.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

type

No

String

Definition

Signing method.

Constraints

N/A

Range

  • type_a: method A.

  • type_b: method B.

  • type_c1: method C1.

  • type_c2: method C2.

Default Value

N/A

expire_time

No

Integer

Definition

How long a signed URL remains effective.

Constraints

N/A

Range

0 to 31,536,000, in seconds.

Default Value

N/A

sign_method

No

String

Definition

Encryption algorithm.

Constraints

N/A

Range

  • md5

  • sha256

Default Value

N/A

match_type

No

String

Definition

Authentication scope, that is, files to authenticate.

Constraints

N/A

Range

  • all: all files.

  • include_file_extension: files with specified extensions.

  • exclude_file_extension: files without specified extensions.

Default Value

N/A

match_rule

No

String

Definition

Rules for matching files to authenticate.

Constraints

N/A

Range

  • When match_type is set to all, this parameter is left blank.

  • When match_type is set to include_file_extension or exclude_file_extension, enter the file name extensions. Start an extension with a period (.) and separate multiple extensions by commas (,). Example: .jpg,.zip,.exe.

Default Value

N/A

inherit_config

No

InheritConfig object

Definition

Authentication inheritance. Authentication parameters are added to TS and MP4 files under M3U8/MPD index files, so that the files can be played after authentication succeeds.

Constraints

N/A

key

No

String

Definition

Authentication key.

Constraints

N/A

Range

  • Enter 6 to 32 characters.

  • Use only letters and digits.

Default Value

N/A

backup_key

No

String

Definition

Secondary authentication key. If you want both the old and new keys to take effect, you can set the old key as the secondary key. Users can access content only after CDN verifies the primary or secondary key.

Constraints

N/A

Range

  • Enter 6 to 32 characters.

  • Use only letters and digits.

Default Value

N/A

sign_arg

No

String

Definition

Authentication parameter carried in a URL.

Constraints

Mandatory when signing method A or C2 is used.

Range

  • Enter 1 to 100 characters.

  • Use only letters, digits, and underscores (_). Do not start with a digit.

Default Value

auth_key

time_format

No

String

Definition

Time format.

Constraints

  • Method A supports only the decimal format.

  • Method B supports only the decimal format.

  • Method C1 supports only the hexadecimal format.

  • Method C2 supports both decimal and hexadecimal formats.

Range

  • dec: decimal.

  • hex: hexadecimal.

Default Value

N/A

time_arg

No

String

Definition

Time parameter name.

Constraints

Optional when signing method C2 is used.

Range

  • Enter 1 to 100 characters.

  • Start with a letter. Use only letters, digits, and underscores (_).

Default Value

timestamp

Table 9 InheritConfig

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

Whether to enable authentication inheritance.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

inherit_type

No

String

Definition

Authentication inheritance settings.

Constraints

  • Separate parameters by commas (,). Example: m3u8,mpd.

  • This parameter is mandatory when authentication inheritance is enabled.

Range

  • m3u8

  • mpd

Default Value

N/A

inherit_time_type

No

String

Definition

Inheritance start time.

Constraints

This parameter is mandatory when authentication inheritance is enabled.

Range

  • sys_time: current system time.

  • parent_url_time: time when a user accesses the M3U8/MPD file.

Default Value

N/A

Table 10 HttpPutBody

Parameter

Mandatory

Type

Description

https_status

No

String

Definition

Certificate status.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

certificate_type

No

String

Definition

Certificate type.

Constraints

N/A

Range

  • server: international certificate.

  • server_sm: Chinese (SM2) certificate.

Default Value

N/A

certificate_source

No

Integer

Definition

Certificate source.

Constraints

Mandatory when a certificate is configured.

Range

  • 0: your certificate.

  • 2: SCM certificate.

Default Value

N/A

scm_certificate_id

No

String

Definition

SCM certificate ID, which can be obtained using the CCM API for listing certificates.

Constraints

Mandatory when an SCM certificate is configured.

Range

N/A

Default Value

N/A

certificate_name

No

String

Definition

Certificate name.

Constraints

  • Mandatory when a certificate is configured.

  • 3 to 64 characters.

Range

N/A

Default Value

N/A

certificate_value

No

String

Definition

Certificate used by the HTTPS protocol.

Constraints

  • Only the PEM format is supported.

  • This parameter is mandatory when a certificate is configured.

  • A complete certificate chain is required.

Range

The certificate chain cannot exceed 20 KB.

Default Value

N/A

private_key

No

String

Definition

Private key used by the HTTPS protocol.

Constraints

  • This parameter is mandatory when a certificate is configured.

  • Only the PEM format is supported.

Range

N/A

Default Value

N/A

enc_certificate_value

No

String

Definition

Encryption certificate content.

Constraints

  • Mandatory when a Chinese (SM2) certificate is used.

  • Only the PEM format is supported.

Range

N/A

Default Value

N/A

enc_private_key

No

String

Definition

Encryption private key.

Constraints

  • Mandatory when a Chinese (SM2) certificate is used.

  • Only the PEM format is supported.

Range

N/A

Default Value

N/A

certificates

No

Array of CertificatesPutBody objects

Definition

Certificate configuration request body.

Constraints

  • Mandatory when two certificates are configured.

  • Two international certificates or two Chinese (SM2) certificates cannot be configured.

  • If an international certificate, Chinese (SM2) certificate, or both certificates are passed in certificates, the outer certificate settings become invalid. The certificate information specified by this parameter is used.

http2_status

No

String

Definition

Whether to enable HTTP/2 to allow clients to use HTTP/2 when accessing CDN PoPs.

Constraints

When https_status is set to off, this parameter does not take effect.

Range

  • on: yes.

  • off: no.

Default Value

off

tls_version

No

String

Definition

Transport Layer Security (TLS) protocol, that is, TLS version settings.

Constraints

  • Enable at least one version.

  • Enable only one version or consecutive versions. For example, you cannot enable TLS 1.0 and TLS 1.2 but disable TLS 1.1.

  • Separate versions by commas (,). Example: TLSv1.1,TLSv1.2.

  • An international certificate has been enabled before you configure TLS versions.

Range

Range: TLSv1.0, TLSv1.1, TLSv1.2, and TLSv1.3.

Default Value

TLSv1.1,TLSv1.2,TLSv1.3

ocsp_stapling_status

No

String

Definition

Whether to enable OCSP stapling.

Constraints

N/A

Range

  • on: yes.

  • off: no.

Default Value

N/A

Table 11 CertificatesPutBody

Parameter

Mandatory

Type

Description

certificate_source

No

Integer

Definition

Certificate source.

Constraints

N/A

Range

  • 0: your certificate.

  • 2: SCM certificate.

Default Value

N/A

scm_certificate_id

No

String

Definition

SCM certificate ID, which can be obtained using the CCM API for listing certificates.

Constraints

Mandatory when an SCM certificate is configured.

Range

N/A

Default Value

N/A

certificate_type

Yes

String

Definition

Certificate type.

Constraints

N/A

Range

  • server: international certificate.

  • server_sm: Chinese (SM2) certificate.

Default Value

N/A

certificate_name

Yes

String

Definition

Certificate name.

Constraints

N/A

Range

3 to 64 characters.

Default Value

N/A

certificate_value

Yes

String

Definition

Certificate used by the HTTPS protocol.

Constraints

Only the PEM format is supported.

Range

N/A

Default Value

N/A

private_key

Yes

String

Definition

Private key used by the HTTPS protocol.

Constraints

Only the PEM format is supported.

Range

N/A

Default Value

N/A

enc_certificate_value

No

String

Definition

Encryption certificate content.

Constraints

  • Mandatory when a Chinese (SM2) certificate is used.

  • Only the PEM format is supported.

Range

N/A

Default Value

N/A

enc_private_key

No

String

Definition

Encryption private key.

Constraints

  • Mandatory when a Chinese (SM2) certificate is used.

  • Only the PEM format is supported.

Range

N/A

Default Value

N/A

Table 12 SourcesConfig

Parameter

Mandatory

Type

Description

origin_type

Yes

String

Definition

Origin server type.

Constraints

N/A

Range

  • ipaddr: IP address.

  • domain: origin server domain name.

  • obs_bucket: OBS bucket domain name.

  • third_bucket: third-party bucket. To use this type of origin servers, submit a service ticket.

Default Value

N/A

origin_addr

Yes

String

Definition

IP address or domain name of the origin server.

Constraints

N/A

Range

N/A

Default Value

N/A

priority

Yes

Integer

Definition

Origin server priority.

Constraints

N/A

Range

1 to 100.

Default Value

N/A

weight

No

Integer

Definition

Weight.

Constraints

N/A

Range

1 to 100.

Default Value

N/A

obs_web_hosting_status

No

String

Definition

Whether to enable OBS static website hosting.

Constraints

Mandatory when the origin server type is set to obs_bucket.

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

http_port

No

Integer

Definition

HTTP port.

Constraints

N/A

Range

1 to 65,535.

Default Value

80

https_port

No

Integer

Definition

HTTPS port.

Constraints

N/A

Range

1 to 65,535.

Default Value

443

host_name

No

String

Definition

Host header.

Constraints

N/A

Range

N/A

Default Value

Acceleration domain name.

obs_bucket_type

No

String

Definition

OBS pull authentication status. This function applies when an OBS bucket is used as an origin server. Enable the function if access to the bucket requires authentication. In this way, CDN PoPs carry the authentication information during origin pull. If the information does not match the OBS bucket, origin pull fails, preventing unauthorized traffic theft.

Constraints

Mandatory when the origin server is an OBS bucket.

Range

  • private: enabled.

  • public: disabled.

Default Value

public

bucket_access_key

No

String

Definition

Access key ID (AK) for accessing the third-party bucket.

Constraints

Mandatory when the origin server is a third-party bucket.

Range

N/A

Default Value

N/A

bucket_secret_key

No

String

Definition

Secret access key (SK) for accessing the third-party bucket.

Constraints

Mandatory when the origin server is a third-party bucket.

Range

N/A

Default Value

N/A

bucket_region

No

String

Definition

Region of the third-party bucket.

Constraints

Mandatory when the origin server is a third-party bucket.

Range

N/A

Default Value

N/A

bucket_name

No

String

Definition

Name of the third-party bucket.

Constraints

Mandatory when the origin server is a third-party bucket.

Range

N/A

Default Value

N/A

Table 13 CacheRules

Parameter

Mandatory

Type

Description

match_type

Yes

String

Definition

Match type.

Constraints

N/A

Range

  • all: all files.

  • file_extension: file name extension.

  • catalog: directory.

  • full_path: full path.

  • home_page: homepage.

Default Value

N/A

match_value

No

String

Definition

Cache rule match content.

Constraints

  • When match_type is set to all, this parameter is left blank.

  • When match_type is set to file_extension, the value of this parameter is a list of up to 100 file types with up to 1,000 characters. A file type starts with a period (.). File types are separated by commas (,) or semicolons (;). Example: .jpg,.zip,.exe.

  • When match_type is set to catalog, the value of this parameter is a list of up to 20 directories with up to 255 characters. A directory starts with a slash (/). Directories are separated by commas (,) or semicolons (;). Example: /test/folder01,/test/folder02.

  • When match_type is set to full_path, the value of this parameter is a full path. A full path starts with a slash (/) and supports wildcard characters (*). A cache rule can contain only one full path, for example, /test/index.html or /test/*.jpg. /* is not allowed.

  • When match_type is set to home_page, this parameter is left blank.

Range

N/A

Default Value

N/A

ttl

No

Integer

Definition

TTL of a resource cached on CDN PoPs.

Constraints

Up to 365 days.

Range

N/A

Default Value

0

ttl_unit

Yes

String

Definition

Unit of the cache TTL.

Constraints

N/A

Range

  • s: second.

  • m: minute.

  • h: hour.

  • d: day.

Default Value

N/A

priority

Yes

Integer

Definition

Cache rule priority. A larger value indicates a higher priority.

Constraints

The priority of a rule must be unique.

Range

1 to 100.

Default Value

N/A

follow_origin

No

String

Definition

Source of the cache TTL, that is, whether CDN PoPs use the cache TTL set on the origin server or that set in cache rules on CDN.

Constraints

N/A

Range

  • on: CDN PoPs use the TTL set on the origin server.

  • off: CDN PoPs use the TTL set in cache rules.

  • min_ttl: CDN PoPs use the shorter TTL between the TTL set on the origin server and that in cache rules.

Default Value

off

force_cache

No

String

Definition

Forcible cache. Specify whether CDN PoP cache ignores the no-cache, private, and no-store fields in the Cache-Control response header sent from the origin server.

Constraints

Forcible cache is used together with cache TTL source. For details about the restrictions and configuration effect, see section "PoP Cache Rules" in the User Guide of CDN.

Range

  • on: enabled.

  • off: disabled.

Default Value

off

url_parameter_type

No

String

Definition

URL parameter filtering.

Constraints

N/A

Range

  • del_params: Ignore specific URL parameters.

  • reserve_params: Retain specific URL parameters.

  • ignore_url_params: Ignore all URL parameters.

  • full_url: Retain all URL parameters.

Default Value

full_url

url_parameter_value

No

String

Definition

URL parameters.

Constraints

  • Enter up to 30 parameters.

  • Separate parameters by commas (,) or semicolons (;).

  • This parameter is mandatory when url_parameter_type is set to del_params or reserve_params.

Range

N/A

Default Value

N/A

Table 14 IpFilter

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

IP ACL type.

Constraints

N/A

Range

  • off: The IP ACL is disabled.

  • black: IP address blacklist.

  • white: IP address whitelist.

Default Value

N/A

value

No

String

Definition

IP ACL.

NOTE:
IPv6 is supported. IP addresses and CIDR blocks in the IP address/Subnet mask format are supported.

Constraints

  • This parameter is optional when type is set to off.

  • Separate rules by commas (,).

  • Enter up to 500 rules.

  • Duplicate IP addresses and CIDR blocks will be removed.

  • Wildcards are not supported, for example, 192.168.0.*.

Range

N/A

Default Value

N/A

Table 15 RefererConfig

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Type of the referer blacklist or whitelist.

Constraints

N/A

Range

  • off: The referer blacklist/whitelist is disabled.

  • black: referer blacklist.

  • white: referer whitelist.

Default Value

N/A

value

No

String

Definition

Domain names or IP addresses.

NOTE:
Domain name and IP address can be entered together. Wildcard domain names and domain names with port numbers are supported.

Constraints

  • Separate domain names and IP addresses by commas (,).

  • Enter up to 1,000 domain names and IP addresses.

  • A port ranges from 1 to 65535.

Range

N/A

Default Value

N/A

include_empty

No

Boolean

Definition

Whether blank referers are included.

NOTE:
A referer blacklist including blank referers indicates that requests without any referers are not allowed to access.

A referer whitelist including blank referers indicates that requests without any referers are allowed to access.

Constraints

N/A

Range

  • true: Blank referers are included.

  • false: Blank referers are not included.

Default Value

false

Table 16 ForceRedirectConfig

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

Force redirect status.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

type

No

String

Definition

Protocol to which requests are forcibly redirected.

Constraints

If force redirect to HTTPS is enabled, an HTTPS certificate must be configured. Otherwise, the access will fail.

Range

  • http: force redirect to HTTP.

  • https: force redirect to HTTPS.

Default Value

N/A

redirect_code

No

Integer

Definition

Redirect status code.

Constraints

N/A

Range

  • 301

  • 302

  • 307

Default Value

N/A

Table 17 Compress

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

Smart compression status.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

type

No

String

Definition

Smart compression type.

Constraints

If multiple smart compression types are configured, Brotli compression is used first.

Range

Separate smart compression types by commas (,).

  • gzip: gzip compression.

  • br: Brotli compression.

Default Value

N/A

file_type

No

String

Definition

Types of files to compress.

Constraints

N/A

Range

  • Enter up to 2,000 characters.

  • Enter up to 50 characters for each type.

  • Separate types by commas (,).

Default Value

The default value is .js,.html,.css,.xml,.json,.shtml,.htm when smart compression is used for the first time. When this function is used again and this value is left empty, the result of the previous setting is used.

compress_min_length

No

Integer

Definition

Minimum size of files to be compressed.

Constraints

CDN compresses files between 0 MB and 30 MB if no specific file size is set.

Range

  • 0 MB to 30 MB. The unit is byte.

Default Value

N/A

compress_max_length

No

Integer

Definition

Maximum size of files to be compressed.

Constraints

CDN compresses files between 0 MB and 30 MB if no specific file size is set.

Range

  • 0 MB to 30 MB. The unit is byte.

Default Value

N/A

Table 18 CacheUrlParameterFilter

Parameter

Mandatory

Type

Description

type

No

String

Definition

Operation type of URL parameters, that is, the URL parameters to cache when a resource is cached.

Constraints

N/A

Range

  • full_url: Cache all parameters.

  • ignore_url_params: Ignore all parameters.

  • del_params: Ignore specific URL parameters.

  • reserve_params: Retain specific URL parameters.

NOTE:
The following parameters of this API are adjusted:

Replaced del_args with del_params.

Replaced reserve_args with reserve_params.

Default Value

N/A

value

No

String

Definition

URL parameters.

Constraints

Separate parameters by semicolons (;).

Range

N/A

Default Value

N/A

Table 19 ErrorCodeCache

Parameter

Mandatory

Type

Description

code

No

Integer

Definition

Error codes to cache.

Constraints

N/A

Range

  • 3xx: 301 and 302.

  • 4xx: 400, 403, 404, 405, 407, 414, 416, and 451.

  • 5xx: 500, 501, 502, 503, 504, 509, and 514.

Default Value

N/A

ttl

No

Integer

Definition

Error code cache TTL.

Constraints

N/A

Range

0 to 31,536,000, in seconds.

NOTE:
The cache TTL of 3XX status codes ranges from 0s to 20s.

Default Value

N/A

Table 20 UserAgentFilter

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

User-Agent ACL type.

Constraints

N/A

Range

  • off: The User-Agent ACL is disabled.

  • black: User-Agent blacklist.

  • white: User-Agent whitelist.

Default Value

N/A

value

No

String

Definition

User-Agent ACL content.

NOTE:
This old parameter will be deprecated recently. Use ua_list to set a User-Agent ACL.

Constraints

  • This parameter is optional when type is set to off.

  • Configure up to 50 rules.

  • Separate rules by commas (,).

Range

  • Enter up to 200 characters for each rule.

  • Use only letters, digits, spaces, and the following special characters: *.-_();,/'#!@$^&+=~?"[]{}:%

Default Value

N/A

include_empty

No

Boolean

Definition

Whether blank user agents are included.

NOTE:
A blacklist including blank user agents indicates that requests without any user agents are not allowed to access.

A whitelist including blank user agents indicates that requests without any user agents are allowed to access.

Constraints

N/A

Range

true: Blank user agents are included.

false: Blank user agents are not included.

Default Value

  • false for blacklists.

  • true for whitelists.

ua_list

No

Array of strings

Definition

User-Agent ACL.

Constraints

  • This parameter is optional when type is set to off.

  • Configure up to 50 rules.

  • Enter up to 200 characters for each rule.

  • When ua_list and value are both set, ua_list is used.

Table 21 OriginRequestUrlRewrite

Parameter

Mandatory

Type

Description

priority

Yes

Integer

Definition

Priority of a URL rewrite rule.

NOTE:
A larger value indicates a higher priority. CDN executes the URL rewrite rule with a higher priority.

Constraints

  • The priority of a rule must be unique.

  • The priority cannot be empty.

Range

1 to 100.

Default Value

N/A

match_type

Yes

String

Definition

Match type.

Constraints

N/A

Range

  • all: all files.

  • file_path: URI path.

  • wildcard: wildcard.

  • full_path: full path.

Default Value

N/A

source_url

No

String

Definition

URI to rewrite.

Constraints

If the match mode is set to all files, this parameter cannot be configured.

Range

  • Enter 1 to 512 characters.

  • Wildcards (*) are supported. Example, /test/*/*.mp4.

  • A URI starts with a slash (/) and does not contain http://, https://, or the domain name.

Default Value

N/A

target_url

Yes

String

Definition

URI after rewrite.

Constraints

Range

  • Enter 1 to 256 characters.

  • A URI starts with a slash (/) and does not contain http://, https://, or the domain name.

NOTE:
The nth wildcard (*) field can be captured by $n, where n = 1, 2, 3, .... Example: /newtest/$1/$2.jpg.

Default Value

N/A

Table 22 flexibleOrigins

Parameter

Mandatory

Type

Description

match_type

Yes

String

Definition

URI match mode.

Constraints

N/A

Range

  • file_extension: file name extension.

  • file_path: directory.

Default Value

N/A

match_pattern

Yes

String

Definition

URI match rule.

Constraints

When match_type is set to file_extension:

  • All file types are supported.

  • Start a file type with a period (.). Separate file types by semicolons (;).

  • Enter up to 20 file types.

When match_type is set to file_path:

  • Start a directory with a slash (/).

  • Separate directories by semicolons (;).

    • Enter up to 20 directories.

NOTE:
File types are case-sensitive.

Range

1 to 512 characters.

Default Value

N/A

priority

Yes

Integer

Definition

Priority.

NOTE:
A larger value indicates a higher priority.

Constraints

N/A

Range

1 to 100.

Default Value

N/A

back_sources

Yes

Array of backSources objects

Definition

Origin server accessed by CDN PoPs for origin pull when a client request matches this rule.

Constraints

Only one origin server in each rule.

Range

N/A

Default Value

N/A

Table 23 backSources

Parameter

Mandatory

Type

Description

sources_type

Yes

String

Definition

Origin server type.

Constraints

N/A

Range

  • ipaddr: IP address.

  • domain: origin server domain name.

  • obs_bucket: OBS bucket domain name.

Default Value

N/A

ip_or_domain

Yes

String

Definition

IP address or domain name of the origin server.

Constraints

N/A

Range

N/A

Default Value

N/A

obs_bucket_type

No

String

Definition

OBS bucket type.

Constraints

N/A

Range

  • private: private bucket.

  • public: public bucket.

Default Value

public

http_port

No

Integer

Definition

HTTP port.

Constraints

N/A

Range

1 to 65,535.

Default Value

80

https_port

No

Integer

Definition

HTTPS port.

Constraints

N/A

Range

1 to 65,535.

Default Value

443

Table 24 commonRemoteAuth

Parameter

Mandatory

Type

Description

remote_authentication

Yes

String

Definition

Whether to enable remote authentication.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

remote_auth_rules

Yes

RemoteAuthRule object

Definition

Remote authentication settings.

Constraints

N/A

Table 25 RemoteAuthRule

Parameter

Mandatory

Type

Description

auth_server

Yes

String

Definition

Address of a reachable authentication server.

Constraints

  • The address must contain http:// or https://.

  • It cannot be a local address such as localhost or 127.0.0.1.

  • It cannot be an acceleration domain name added on CDN.

Range

N/A

Default Value

N/A

request_method

Yes

String

Definition

Request method supported by the authentication server.

Constraints

N/A

Range

  • GET

  • POST

  • HEAD

Default Value

N/A

file_type_setting

Yes

String

Definition

Range of files to authenticate.

Constraints

N/A

Range

  • all: all files.

  • specific_file: files of the specified types. Example: jpg|MP4.

NOTE:
File types are case-insensitive. For example, jpg and JPG indicate the same file type. File types are separated by vertical bars (|).

Default Value

N/A

specified_file_type

No

String

Definition

Types of files to authenticate.

Constraints

  • This parameter is mandatory when file_type_setting is set to specific_file. In other cases, it is left blank.

  • Separate file types by vertical bars (|). Example: jpg|mp4.

  • This parameter is verified only when it is mandatory.

Range

  • Enter 1 to 512 characters.

  • Use only letters and digits.

Default Value

N/A

reserve_args_setting

Yes

String

Definition

Whether to retain or ignore parameters for authentication.

Constraints

N/A

Range

  • reserve_all_args: Retain all URL parameters.

  • reserve_specific_args: Retain specific URL parameters.

  • ignore_all_args: Ignore all URL parameters.

Default Value

N/A

reserve_args

No

String

Definition

Parameters.

Constraints

  • This parameter is mandatory when reserve_args_setting is set to reserve_specific_args. In other cases, this parameter is left blank.

  • Separate parameters by vertical bars (|). Example: key1|key2.

Range

N/A

Default Value

N/A

add_custom_args_rules

No

Array of customArgs objects

Definition

Parameters to be added when CDN PoPs forward user requests to the remote authentication server.

Constraints

N/A

Range

N/A

Default Value

N/A

reserve_headers_setting

Yes

String

Definition

Whether to retain or ignore request headers when CDN PoPs forward user requests to the remote authentication server.

Constraints

N/A

Range

  • reserve_all_headers: Retain all request headers.

  • reserve_specific_headers: Retain specific request headers.

  • ignore_all_headers: Ignore all request headers.

Default Value

N/A

add_custom_headers_rules

No

Array of customArgs objects

Definition

Request headers to authenticate.

Constraints

N/A

Range

N/A

Default Value

N/A

auth_success_status

Yes

String

Definition

Status code returned by the remote authentication server to CDN PoPs when authentication is successful.

Constraints

N/A

Range

  • 2xx

  • 3xx

Default Value

N/A

auth_failed_status

Yes

String

Definition

Status code returned by the remote authentication server to CDN PoPs when authentication fails.

Constraints

N/A

Range

  • 4xx

  • 5xx

Default Value

N/A

response_status

Yes

String

Definition

Status code returned by CDN PoPs to users when authentication fails.

Constraints

N/A

Range

  • 2xx

  • 3xx

  • 4xx

  • 5xx

Default Value

N/A

timeout

Yes

Integer

Definition

Authentication timeout interval, that is, the interval from the time when a CDN PoP forwards an authentication request to the time when the CDN PoP receives the result returned by the remote authentication server.

Constraints

N/A

Range

0 or 50 to 3,000, in milliseconds.

Default Value

N/A

timeout_action

Yes

String

Definition

Method used by CDN PoPs to process a user request after authentication times out.

Constraints

N/A

Range

  • pass: The user request will be accepted and the requested resource will be returned.

  • forbid: The user request will be rejected and the configured custom response status code will be returned.

Default Value

N/A

reserve_headers

No

String

Definition

Request headers to retain.

Constraints

  • This parameter is mandatory when reserve_headers_setting is set to reserve_specific_headers. In other cases, this parameter is left blank.

  • Separate request headers by vertical bars (|). Example: key1|key2.

Range

N/A

Default Value

N/A

Table 26 customArgs

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Parameter type.

Constraints

N/A

Range

  • custom_var: custom.

  • nginx_preset_var: preset variable.

Default Value

N/A

key

Yes

String

Definition

Parameter name.

Constraints

N/A

Range

  • Enter 1 to 256 characters.

  • Use only letters, digits, and the following special characters: ._-*#%|+^@?=

Default Value

N/A

value

Yes

String

Definition

Parameter value.

Constraints

N/A

Range

  • When type is set to custom_var, enter 1 to 256 characters and use only letters, digits, and the following special characters: ._-*#%|+^@?=

  • When type is set to nginx_preset_var, the value can only be set to $http_host, $http_user_agent, $http_referer, $http_x_forwarded_for, $http_content_type, $remote_addr, $scheme, $server_protocol, $request_uri, $uri, $args, and $request_method.

Default Value

N/A

Table 27 webSocketSeek

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

Whether to enable the WebSocket protocol.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

timeout

No

Integer

Definition

Duration for keeping a connection open.

Constraints

N/A

Range

1 to 300, in seconds. This parameter is mandatory when status is set to on.

Default Value

N/A

Table 28 videoSeek

Parameter

Mandatory

Type

Description

enable_video_seek

Yes

Boolean

Definition

Video seek status.

Constraints

When this parameter is set to false, the API for querying domain name configuration does not return the video seek settings.

Range

  • true: enabled.

  • false: disabled.

Default Value

N/A

enable_flv_by_time_seek

No

Boolean

Definition

Time-based FLV seek status.

Constraints

N/A

Range

  • true: enabled.

  • false: disabled.

Default Value

N/A

start_parameter

No

String

Definition

Start parameter of video playback in URLs requested by users.

Constraints

N/A

Range

  • Enter 1 to 64 characters.

  • Use only letters, digits, and underscores (_).

Default Value

N/A

end_parameter

No

String

Definition

End parameter of video playback in URLs requested by users.

Constraints

N/A

Range

  • Enter 1 to 64 characters.

  • Use only letters, digits, and underscores (_).

Default Value

N/A

Table 29 RequestLimitRules

Parameter

Mandatory

Type

Description

status

No

String

Definition

Whether to enable request rate limiting.

NOTE:
  • This parameter is used in earlier APIs and will be deprecated.

  • The value can only be on. off is invalid.

Constraints

If request_limit_rules is left empty, request rate limiting is disabled.

Range

on

Default Value

N/A

priority

Yes

Integer

Definition

Priority.

NOTE:
A larger value indicates a higher priority.

Constraints

The priority of a rule must be unique.

Range

1 to 100.

Default Value

N/A

match_type

Yes

String

Definition

Match type.

Constraints

N/A

Range

  • all: all files.

  • catalog: directory.

Default Value

N/A

match_value

No

String

Definition

Match type value.

Constraints

  • When match_type is set to all, leave this parameter empty.

  • When match_type is set to catalog, the value is a directory address starting with a slash (/), for example, /test.

  • This parameter is mandatory when match_type is set to catalog.

Range

N/A

Default Value

N/A

type

Yes

String

Definition

Rate limit mode.

Constraints

Currently, only rate limit by traffic is supported. This parameter can only be set to size.

Range

N/A

Default Value

N/A

limit_rate_after

Yes

Long

Definition

Rate limit condition.

NOTE:
For example, type=size,limit_rate_after=50 indicates that the speed is limited to the value of limit_rate_value after 50 bytes are transmitted.

Constraints

N/A

Range

0 to 1,073,741,824, in bytes.

Default Value

N/A

limit_rate_value

Yes

Integer

Definition

Rate limit, that is, the maximum access speed after the rate limit is reached.

Constraints

N/A

Range

0 to 104,857,600, in bit/s.

Default Value

N/A

limit_time

No

String

Definition

Periods when the rate is limited.

Constraints

  • Periods are in the 24-hour clock. Period format: HHMM-HHMM (in UTC+08:00).

  • Separate periods by commas (,). Example: 0100-0200,2200-2300.

  • Enter up to 10 periods.

Range

N/A

Default Value

0000-2400

Table 30 IpFrequencyLimit

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

IP access frequency status.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

qps

No

Integer

Definition

Access threshold.

Constraints

This parameter is mandatory when IP access frequency is enabled.

Range

1 to 100,000, in requests per second.

Default Value

N/A

Table 31 Hsts

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

HSTS status.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

max_age

No

Integer

Definition

Expiration time, that is, the TTL of the response header Strict-Transport-Security on clients.

Constraints

This parameter is mandatory when status is set to on.

Range

0 to 63,072,000, in seconds.

Default Value

N/A

include_subdomains

No

String

Definition

Whether to include subdomain names.

Constraints

This parameter is mandatory when status is set to on.

Range

  • on: yes.

  • off: no.

Default Value

N/A

Table 32 Quic

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

QUIC status.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

Table 33 ErrorCodeRedirectRules

Parameter

Mandatory

Type

Description

error_code

Yes

Integer

Definition

Redirection error code.

Constraints

N/A

Range

  • 4xx: 400, 403, 404, 405, 414, 416, and 451.

  • 5xx: 500, 501, 502, 503, and 504.

Default Value

N/A

target_code

Yes

Integer

Definition

Redirection status code.

Constraints

N/A

Range

  • 301

  • 302

Default Value

N/A

target_link

Yes

String

Definition

Destination URL.

Constraints

Start with http:// or https://.

Range

N/A

Default Value

N/A

Table 34 Sni

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

Whether to enable origin SNI.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

server_name

No

String

Definition

SNI domain name used for HTTPS handshake during CDN PoP origin pull.

Constraints

  • This parameter is mandatory when origin SNI is enabled.

Range

  • Use only letters, digits, hyphens (-), and periods (.).

Default Value

Table 35 RequestUrlRewrite

Parameter

Mandatory

Type

Description

condition

Yes

UrlRewriteCondition object

Definition

Match condition.

Constraints

N/A

Range

N/A

Default Value

N/A

redirect_status_code

No

Integer

Definition

Redirection status code.

Constraints

N/A

Range

  • 301

  • 302

  • 303

  • 307

Default Value

N/A

redirect_url

Yes

String

Definition

Redirection URL.

Constraints

  • A target URL starts with a slash (/) and does not contain http://, https://, or the domain name. Example: /test/index.html.

  • When the match type is set to full path, the wildcard (*) can be captured by $1. For example, if the content is /test/*.jpg and the redirection URL is /newtest/$1.jpg, when a user requests /test/11.jpg, $1 is replaced by 11, so the requested URL after redirection is /newtest/11.jpg.

Range

N/A

Default Value

N/A

redirect_host

No

String

Definition

Domain name to which client requests are redirected.

Constraints

N/A

Range

  • Enter 1 to 255 characters.

  • Start with http:// or https://.

Default Value

Acceleration domain name.

execution_mode

Yes

String

Definition

Action.

Constraints

N/A

Range

  • redirect: If the requested URL matches this rule, the request is redirected to the target URL. After this rule is executed, if other rules exist, CDN continues to execute these rules.

  • break: If the requested URL matches this rule, the request is redirected to the target URL. After this rule is executed, CDN does not execute any other rules and returns status code 200. You cannot set the redirection host or status code.

Default Value

N/A

Table 36 UrlRewriteCondition

Parameter

Mandatory

Type

Description

match_type

Yes

String

Definition

Match type.

Constraints

N/A

Range

  • catalog: The rule is executed for files in the specified directory.

  • full_path: The rule is executed for the file of the specified path.

Default Value

N/A

match_value

Yes

String

Definition

Match content.

Constraints

  • When match_type is set to catalog, the value of this parameter is a list of up to 20 directories. A directory starts with a slash (/). Directories are separated by commas (,). Example: /test/folder01,/test/folder02.

  • When match_type is set to full_path, the value of this parameter is a full path. A full path starts with a slash (/) and supports wildcard characters (*). A rule can contain only one full path. Example: /test/index.html or /test/*.jpg.

Range

N/A

Default Value

N/A

priority

Yes

Integer

Definition

Priority of the access URL rewrite rule.

NOTE:
A larger value indicates a higher priority.

Constraints

The priority of a rule must be unique.

Range

1 to 100.

Default Value

N/A

Table 37 BrowserCacheRules

Parameter

Mandatory

Type

Description

condition

Yes

BrowserCacheRulesCondition object

Definition

Match condition.

Constraints

N/A

Range

N/A

Default Value

N/A

cache_type

Yes

String

Definition

Cache effective type.

Constraints

N/A

Range

  • follow_origin: The cache policy of the origin server, that is, the setting of the Cache-Control header, is used.

  • ttl: The TTL set in this rule is used.

  • never: Browsers do not cache the resources.

Default Value

N/A

ttl

No

Integer

Definition

Cache TTL.

Constraints

  • Up to 365 days.

  • Mandatory when the cache effective type is set to ttl.

Range

N/A

Default Value

N/A

ttl_unit

No

String

Definition

Unit of the cache TTL.

Constraints

Mandatory when the cache effective type is set to ttl.

Range

  • s: second.

  • m: minute.

  • h: hour.

  • d: day.

Default Value

N/A

Table 38 BrowserCacheRulesCondition

Parameter

Mandatory

Type

Description

match_type

Yes

String

Definition

Match type.

Constraints

N/A

Range

  • all: all files.

  • file_extension: file name extension.

  • catalog: directory.

  • full_path: full path.

  • home_page: homepage.

Default Value

N/A

match_value

No

String

Definition

Cache content based on the cache rule.

Constraints

  • When match_type is set to all, this parameter is left blank.

  • When match_type is set to file_extension, the value of this parameter is a list of up to 20 file types. A file type starts with a period (.). File types are separated by commas (,). Example: .jpg,.zip,.exe.

  • When match_type is set to catalog, the value of this parameter is a list of up to 20 directories. A directory starts with a slash (/). Directories are separated by commas (,). Example: /test/folder01,/test/folder02.

  • When match_type is set to full_path, the value of this parameter is a full path. A full path starts with a slash (/) and supports wildcard characters (*), but cannot end with a wildcard (*). A wildcard (*) can only follow the last slash (/). A rule can contain only one full path. Example: /test/index.html or /test/*.jpg.

  • When match_type is set to home_page, this parameter is left blank.

Range

N/A

Default Value

N/A

priority

Yes

Integer

Definition

Priority of the browser cache rule. A larger value indicates a higher priority.

Constraints

The priority of a rule must be unique.

Range

N/A

Default Value

1 to 100.

Table 39 AccessAreaFilter

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Rule type.

Constraints

N/A

Range

  • black: blacklist. Users in regions specified in the blacklist cannot access resources and status code 403 is returned.

  • white: whitelist. Only users in regions specified in the whitelist can access resources. Status code 403 is returned for other users.

Default Value

N/A

content_type

Yes

String

Definition

Content type.

Constraints

N/A

Range

  • all: The rule takes effect for all files.

  • file_directory: The rule takes effect for resources in the specified directory.

  • file_path: The rule takes effect for resources corresponding to the path.

Default Value

N/A

content_value

No

String

Definition

Rule.

Constraints

  • When content_type is set to all, this parameter is empty or not passed.

  • When content_type is set to file_directory, the value is a list of up to 100 directories. A directory starts with a slash (/). Multiple directories are separated by commas (,). Example: /test/folder01,/test/folder02.

  • When content_type is set to file_path, the value is a list of up to 100 file paths. A path starts with a slash (/) or wildcard (*). Up to two wildcards (*) are allowed and they cannot be consecutive. Multiple paths are separated by commas (,). Example: /test/a.txt,/test/b.txt.

  • Each whitelist or blacklist rule must be unique.

  • You can configure only one rule for all files.

Range

N/A

Default Value

N/A

area

Yes

String

Definition

Regions to which the rule applies.

Constraints

  • Separate regions by commas (,).

  • Example: CN_IN,AF,IE,EG,AU (Chinese mainland, Afghanistan, Ireland, Egypt, and Australia). For details about the location codes, see section "Appendix" > "Geographical Location Codes".

Range

N/A

Default Value

N/A

exception_ip

No

String

Definition

Exception IP addresses excluded from this rule.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 40 ClientCert

Parameter

Mandatory

Type

Description

status

Yes

String

Definition

Client certificate status.

Constraints

N/A

Range

  • on: enabled.

  • off: disabled.

Default Value

N/A

trusted_cert

Yes

String

Definition

Content of the client CA certificate.

Constraints

Only the PEM format is supported.

Range

N/A

Default Value

N/A

hosts

No

String

Definition

Domain names specified in the client CA certificate.

Constraints

  • Leave this parameter blank to allow all requests from clients that hold the CA certificate.

  • Add up to 100 domain names.

  • Separate domain names by commas (,) or vertical bars (|).

Range

N/A

Default Value

N/A

Response Parameters

Status code: 204

Request succeeded.

None

Example Requests

PUT https://cdn.myhuaweicloud.com/v1.1/cdn/configuration/domains/www.example.com/configs

{
  "configs" : {
    "origin_request_header" : [ {
      "name" : "test-name",
      "value" : "test_value",
      "action" : "set"
    } ],
    "http_response_header" : [ {
      "name" : "test-name",
      "value" : "test_value",
      "action" : "set"
    } ],
    "url_auth" : {
      "status" : "off"
    },
    "compress" : {
      "status" : "off"
    },
    "force_redirect" : {
      "status" : "on",
      "type" : "http",
      "redirect_code" : 301
    },
    "origin_protocol" : "follow",
    "referer" : {
      "type" : "black",
      "value" : "192.168.0.0",
      "include_empty" : true
    },
    "ip_filter" : {
      "type" : "black",
      "value" : "192.168.0.0"
    },
    "origin_follow302_status" : "off",
    "cache_rules" : [ {
      "match_type" : "file_extension",
      "match_value" : ".zip",
      "ttl" : 0,
      "ttl_unit" : "h",
      "priority" : 10,
      "follow_origin" : "off",
      "url_parameter_type" : "del_params",
      "url_parameter_value" : "test_param"
    } ],
    "sources" : [ {
      "origin_addr" : "www.example.com",
      "origin_type" : "domain",
      "priority" : 70,
      "http_port" : 80,
      "https_port" : 443
    } ],
    "flexible_origin" : [ {
      "priority" : 1,
      "match_type" : "file_path",
      "match_pattern" : "/test",
      "back_sources" : [ {
        "sources_type" : "domain",
        "ip_or_domain" : "www.back.example.com"
      } ]
    } ],
    "slice_etag_status" : "off",
    "ipv6_accelerate" : 1,
    "origin_receive_timeout" : 30,
    "remote_auth" : {
      "remote_authentication" : "on",
      "remote_auth_rules" : {
        "auth_server" : "https://192.168.0.0",
        "request_method" : "GET",
        "file_type_setting" : "all",
        "reserve_args_setting" : "reserve_all_args",
        "reserve_headers_setting" : "reserve_specific_headers",
        "auth_success_status" : "200",
        "auth_failed_status" : "403",
        "response_status" : "403",
        "timeout" : 500,
        "timeout_action" : "pass",
        "reserve_headers" : "sf",
        "add_custom_args_rules" : [ {
          "type" : "nginx_preset_var",
          "key" : "http_host",
          "value" : "$http_host"
        } ],
        "add_custom_headers_rules" : [ {
          "type" : "nginx_preset_var",
          "key" : "http_host",
          "value" : "$http_host"
        } ]
      }
    },
    "websocket" : {
      "status" : "on",
      "timeout" : 60
    },
    "video_seek" : {
      "enable_video_seek" : true,
      "enable_flv_by_time_seek" : true,
      "start_parameter" : "start",
      "end_parameter" : "end"
    },
    "request_limit_rules" : [ {
      "status" : "on",
      "match_type" : "catalog",
      "match_value" : "/test",
      "type" : "size",
      "limit_rate_after" : 1024,
      "limit_rate_value" : 50,
      "priority" : 88
    } ],
    "sni" : {
      "status" : "on",
      "server_name" : "test.example.com"
    },
    "request_url_rewrite" : [ {
      "condition" : {
        "match_type" : "full_path",
        "match_value" : "/test/*.jpg",
        "priority" : 10
      },
      "redirect_status_code" : 301,
      "redirect_url" : "/test/index.html",
      "redirect_host" : "http://www.example.com",
      "execution_mode" : "redirect"
    } ],
    "browser_cache_rules" : [ {
      "condition" : {
        "match_type" : "full_path",
        "match_value" : "/test/*.jpg",
        "priority" : 10
      },
      "cache_type" : "ttl",
      "ttl" : 20,
      "ttl_unit" : "h"
    } ],
    "access_area_filter" : [ {
      "type" : "black",
      "content_type" : "all",
      "area" : "CN_IN,AU",
      "exception_ip" : "0.0.0.0"
    } ],
    "client_cert" : {
      "status" : "on",
      "trusted_cert" : "certificate_example",
      "hosts" : "www.example.com"
    }
  }
}

Example Responses

None

SDK Sample Code

The SDK sample code is as follows.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.GlobalCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.cdn.v2.region.CdnRegion;
import com.huaweicloud.sdk.cdn.v2.*;
import com.huaweicloud.sdk.cdn.v2.model.*;

import java.util.List;
import java.util.ArrayList;

public class UpdateDomainFullConfigSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new GlobalCredentials()
                .withAk(ak)
                .withSk(sk);

        CdnClient client = CdnClient.newBuilder()
                .withCredential(auth)
                .withRegion(CdnRegion.valueOf("<YOUR REGION>"))
                .build();
        UpdateDomainFullConfigRequest request = new UpdateDomainFullConfigRequest();
        request.withDomainName("{domain_name}");
        ModifyDomainConfigRequestBody body = new ModifyDomainConfigRequestBody();
        ClientCert clientCertConfigs = new ClientCert();
        clientCertConfigs.withStatus("on")
            .withTrustedCert("certificate_example")
            .withHosts("www.example.com");
        List<AccessAreaFilter> listConfigsAccessAreaFilter = new ArrayList<>();
        listConfigsAccessAreaFilter.add(
            new AccessAreaFilter()
                .withType("black")
                .withContentType("all")
                .withArea("CN_IN,AU")
                .withExceptionIp("0.0.0.0")
        );
        BrowserCacheRulesCondition conditionBrowserCacheRules = new BrowserCacheRulesCondition();
        conditionBrowserCacheRules.withMatchType("full_path")
            .withMatchValue("/test/*.jpg")
            .withPriority(10);
        List<BrowserCacheRules> listConfigsBrowserCacheRules = new ArrayList<>();
        listConfigsBrowserCacheRules.add(
            new BrowserCacheRules()
                .withCondition(conditionBrowserCacheRules)
                .withCacheType("ttl")
                .withTtl(20)
                .withTtlUnit("h")
        );
        UrlRewriteCondition conditionRequestUrlRewrite = new UrlRewriteCondition();
        conditionRequestUrlRewrite.withMatchType("full_path")
            .withMatchValue("/test/*.jpg")
            .withPriority(10);
        List<RequestUrlRewrite> listConfigsRequestUrlRewrite = new ArrayList<>();
        listConfigsRequestUrlRewrite.add(
            new RequestUrlRewrite()
                .withCondition(conditionRequestUrlRewrite)
                .withRedirectStatusCode(301)
                .withRedirectUrl("/test/index.html")
                .withRedirectHost("http://www.example.com")
                .withExecutionMode("redirect")
        );
        Sni sniConfigs = new Sni();
        sniConfigs.withStatus("on")
            .withServerName("test.example.com");
        List<RequestLimitRules> listConfigsRequestLimitRules = new ArrayList<>();
        listConfigsRequestLimitRules.add(
            new RequestLimitRules()
                .withStatus("on")
                .withPriority(88)
                .withMatchType("catalog")
                .withMatchValue("/test")
                .withType("size")
                .withLimitRateAfter(1024L)
                .withLimitRateValue(50)
        );
        VideoSeek videoSeekConfigs = new VideoSeek();
        videoSeekConfigs.withEnableVideoSeek(true)
            .withEnableFlvByTimeSeek(true)
            .withStartParameter("start")
            .withEndParameter("end");
        WebSocketSeek websocketConfigs = new WebSocketSeek();
        websocketConfigs.withStatus("on")
            .withTimeout(60);
        List<CustomArgs> listRemoteAuthRulesAddCustomHeadersRules = new ArrayList<>();
        listRemoteAuthRulesAddCustomHeadersRules.add(
            new CustomArgs()
                .withType("nginx_preset_var")
                .withKey("http_host")
                .withValue("$http_host")
        );
        List<CustomArgs> listRemoteAuthRulesAddCustomArgsRules = new ArrayList<>();
        listRemoteAuthRulesAddCustomArgsRules.add(
            new CustomArgs()
                .withType("nginx_preset_var")
                .withKey("http_host")
                .withValue("$http_host")
        );
        RemoteAuthRule remoteAuthRulesRemoteAuth = new RemoteAuthRule();
        remoteAuthRulesRemoteAuth.withAuthServer("https://192.168.0.0")
            .withRequestMethod("GET")
            .withFileTypeSetting("all")
            .withReserveArgsSetting("reserve_all_args")
            .withAddCustomArgsRules(listRemoteAuthRulesAddCustomArgsRules)
            .withReserveHeadersSetting("reserve_specific_headers")
            .withAddCustomHeadersRules(listRemoteAuthRulesAddCustomHeadersRules)
            .withAuthSuccessStatus("200")
            .withAuthFailedStatus("403")
            .withResponseStatus("403")
            .withTimeout(500)
            .withTimeoutAction("pass")
            .withReserveHeaders("sf");
        CommonRemoteAuth remoteAuthConfigs = new CommonRemoteAuth();
        remoteAuthConfigs.withRemoteAuthentication("on")
            .withRemoteAuthRules(remoteAuthRulesRemoteAuth);
        List<BackSources> listFlexibleOriginBackSources = new ArrayList<>();
        listFlexibleOriginBackSources.add(
            new BackSources()
                .withSourcesType("domain")
                .withIpOrDomain("www.back.example.com")
        );
        List<FlexibleOrigins> listConfigsFlexibleOrigin = new ArrayList<>();
        listConfigsFlexibleOrigin.add(
            new FlexibleOrigins()
                .withMatchType("file_path")
                .withMatchPattern("/test")
                .withPriority(1)
                .withBackSources(listFlexibleOriginBackSources)
        );
        Compress compressConfigs = new Compress();
        compressConfigs.withStatus("off");
        ForceRedirectConfig forceRedirectConfigs = new ForceRedirectConfig();
        forceRedirectConfigs.withStatus("on")
            .withType("http")
            .withRedirectCode(301);
        RefererConfig refererConfigs = new RefererConfig();
        refererConfigs.withType("black")
            .withValue("192.168.0.0")
            .withIncludeEmpty(true);
        IpFilter ipFilterConfigs = new IpFilter();
        ipFilterConfigs.withType("black")
            .withValue("192.168.0.0");
        List<CacheRules> listConfigsCacheRules = new ArrayList<>();
        listConfigsCacheRules.add(
            new CacheRules()
                .withMatchType("file_extension")
                .withMatchValue(".zip")
                .withTtl(0)
                .withTtlUnit("h")
                .withPriority(10)
                .withFollowOrigin("off")
                .withUrlParameterType("del_params")
                .withUrlParameterValue("test_param")
        );
        List<SourcesConfig> listConfigsSources = new ArrayList<>();
        listConfigsSources.add(
            new SourcesConfig()
                .withOriginType("domain")
                .withOriginAddr("www.example.com")
                .withPriority(70)
                .withHttpPort(80)
                .withHttpsPort(443)
        );
        UrlAuth urlAuthConfigs = new UrlAuth();
        urlAuthConfigs.withStatus("off");
        List<HttpResponseHeader> listConfigsHttpResponseHeader = new ArrayList<>();
        listConfigsHttpResponseHeader.add(
            new HttpResponseHeader()
                .withName("test-name")
                .withValue("test_value")
                .withAction("set")
        );
        List<OriginRequestHeader> listConfigsOriginRequestHeader = new ArrayList<>();
        listConfigsOriginRequestHeader.add(
            new OriginRequestHeader()
                .withName("test-name")
                .withValue("test_value")
                .withAction("set")
        );
        Configs configsbody = new Configs();
        configsbody.withOriginRequestHeader(listConfigsOriginRequestHeader)
            .withHttpResponseHeader(listConfigsHttpResponseHeader)
            .withUrlAuth(urlAuthConfigs)
            .withSources(listConfigsSources)
            .withOriginProtocol("follow")
            .withOriginFollow302Status("off")
            .withCacheRules(listConfigsCacheRules)
            .withIpFilter(ipFilterConfigs)
            .withReferer(refererConfigs)
            .withForceRedirect(forceRedirectConfigs)
            .withCompress(compressConfigs)
            .withIpv6Accelerate(1)
            .withFlexibleOrigin(listConfigsFlexibleOrigin)
            .withSliceEtagStatus("off")
            .withOriginReceiveTimeout(30)
            .withRemoteAuth(remoteAuthConfigs)
            .withWebsocket(websocketConfigs)
            .withVideoSeek(videoSeekConfigs)
            .withRequestLimitRules(listConfigsRequestLimitRules)
            .withSni(sniConfigs)
            .withRequestUrlRewrite(listConfigsRequestUrlRewrite)
            .withBrowserCacheRules(listConfigsBrowserCacheRules)
            .withAccessAreaFilter(listConfigsAccessAreaFilter)
            .withClientCert(clientCertConfigs);
        body.withConfigs(configsbody);
        request.withBody(body);
        try {
            UpdateDomainFullConfigResponse response = client.updateDomainFullConfig(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import GlobalCredentials
from huaweicloudsdkcdn.v2.region.cdn_region import CdnRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcdn.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = GlobalCredentials(ak, sk)

    client = CdnClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CdnRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = UpdateDomainFullConfigRequest()
        request.domain_name = "{domain_name}"
        clientCertConfigs = ClientCert(
            status="on",
            trusted_cert="certificate_example",
            hosts="www.example.com"
        )
        listAccessAreaFilterConfigs = [
            AccessAreaFilter(
                type="black",
                content_type="all",
                area="CN_IN,AU",
                exception_ip="0.0.0.0"
            )
        ]
        conditionBrowserCacheRules = BrowserCacheRulesCondition(
            match_type="full_path",
            match_value="/test/*.jpg",
            priority=10
        )
        listBrowserCacheRulesConfigs = [
            BrowserCacheRules(
                condition=conditionBrowserCacheRules,
                cache_type="ttl",
                ttl=20,
                ttl_unit="h"
            )
        ]
        conditionRequestUrlRewrite = UrlRewriteCondition(
            match_type="full_path",
            match_value="/test/*.jpg",
            priority=10
        )
        listRequestUrlRewriteConfigs = [
            RequestUrlRewrite(
                condition=conditionRequestUrlRewrite,
                redirect_status_code=301,
                redirect_url="/test/index.html",
                redirect_host="http://www.example.com",
                execution_mode="redirect"
            )
        ]
        sniConfigs = Sni(
            status="on",
            server_name="test.example.com"
        )
        listRequestLimitRulesConfigs = [
            RequestLimitRules(
                status="on",
                priority=88,
                match_type="catalog",
                match_value="/test",
                type="size",
                limit_rate_after=1024,
                limit_rate_value=50
            )
        ]
        videoSeekConfigs = VideoSeek(
            enable_video_seek=True,
            enable_flv_by_time_seek=True,
            start_parameter="start",
            end_parameter="end"
        )
        websocketConfigs = WebSocketSeek(
            status="on",
            timeout=60
        )
        listAddCustomHeadersRulesRemoteAuthRules = [
            CustomArgs(
                type="nginx_preset_var",
                key="http_host",
                value="$http_host"
            )
        ]
        listAddCustomArgsRulesRemoteAuthRules = [
            CustomArgs(
                type="nginx_preset_var",
                key="http_host",
                value="$http_host"
            )
        ]
        remoteAuthRulesRemoteAuth = RemoteAuthRule(
            auth_server="https://192.168.0.0",
            request_method="GET",
            file_type_setting="all",
            reserve_args_setting="reserve_all_args",
            add_custom_args_rules=listAddCustomArgsRulesRemoteAuthRules,
            reserve_headers_setting="reserve_specific_headers",
            add_custom_headers_rules=listAddCustomHeadersRulesRemoteAuthRules,
            auth_success_status="200",
            auth_failed_status="403",
            response_status="403",
            timeout=500,
            timeout_action="pass",
            reserve_headers="sf"
        )
        remoteAuthConfigs = CommonRemoteAuth(
            remote_authentication="on",
            remote_auth_rules=remoteAuthRulesRemoteAuth
        )
        listBackSourcesFlexibleOrigin = [
            BackSources(
                sources_type="domain",
                ip_or_domain="www.back.example.com"
            )
        ]
        listFlexibleOriginConfigs = [
            FlexibleOrigins(
                match_type="file_path",
                match_pattern="/test",
                priority=1,
                back_sources=listBackSourcesFlexibleOrigin
            )
        ]
        compressConfigs = Compress(
            status="off"
        )
        forceRedirectConfigs = ForceRedirectConfig(
            status="on",
            type="http",
            redirect_code=301
        )
        refererConfigs = RefererConfig(
            type="black",
            value="192.168.0.0",
            include_empty=True
        )
        ipFilterConfigs = IpFilter(
            type="black",
            value="192.168.0.0"
        )
        listCacheRulesConfigs = [
            CacheRules(
                match_type="file_extension",
                match_value=".zip",
                ttl=0,
                ttl_unit="h",
                priority=10,
                follow_origin="off",
                url_parameter_type="del_params",
                url_parameter_value="test_param"
            )
        ]
        listSourcesConfigs = [
            SourcesConfig(
                origin_type="domain",
                origin_addr="www.example.com",
                priority=70,
                http_port=80,
                https_port=443
            )
        ]
        urlAuthConfigs = UrlAuth(
            status="off"
        )
        listHttpResponseHeaderConfigs = [
            HttpResponseHeader(
                name="test-name",
                value="test_value",
                action="set"
            )
        ]
        listOriginRequestHeaderConfigs = [
            OriginRequestHeader(
                name="test-name",
                value="test_value",
                action="set"
            )
        ]
        configsbody = Configs(
            origin_request_header=listOriginRequestHeaderConfigs,
            http_response_header=listHttpResponseHeaderConfigs,
            url_auth=urlAuthConfigs,
            sources=listSourcesConfigs,
            origin_protocol="follow",
            origin_follow302_status="off",
            cache_rules=listCacheRulesConfigs,
            ip_filter=ipFilterConfigs,
            referer=refererConfigs,
            force_redirect=forceRedirectConfigs,
            compress=compressConfigs,
            ipv6_accelerate=1,
            flexible_origin=listFlexibleOriginConfigs,
            slice_etag_status="off",
            origin_receive_timeout=30,
            remote_auth=remoteAuthConfigs,
            websocket=websocketConfigs,
            video_seek=videoSeekConfigs,
            request_limit_rules=listRequestLimitRulesConfigs,
            sni=sniConfigs,
            request_url_rewrite=listRequestUrlRewriteConfigs,
            browser_cache_rules=listBrowserCacheRulesConfigs,
            access_area_filter=listAccessAreaFilterConfigs,
            client_cert=clientCertConfigs
        )
        request.body = ModifyDomainConfigRequestBody(
            configs=configsbody
        )
        response = client.update_domain_full_config(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
    cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := global.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := cdn.NewCdnClient(
        cdn.CdnClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.UpdateDomainFullConfigRequest{}
	request.DomainName = "{domain_name}"
	hostsClientCert:= "www.example.com"
	clientCertConfigs := &model.ClientCert{
		Status: "on",
		TrustedCert: "certificate_example",
		Hosts: &hostsClientCert,
	}
	typeAccessAreaFilter:= "black"
	contentTypeAccessAreaFilter:= "all"
	areaAccessAreaFilter:= "CN_IN,AU"
	exceptionIpAccessAreaFilter:= "0.0.0.0"
	var listAccessAreaFilterConfigs = []model.AccessAreaFilter{
        {
            Type: &typeAccessAreaFilter,
            ContentType: &contentTypeAccessAreaFilter,
            Area: &areaAccessAreaFilter,
            ExceptionIp: &exceptionIpAccessAreaFilter,
        },
    }
	matchValueCondition:= "/test/*.jpg"
	conditionBrowserCacheRules := &model.BrowserCacheRulesCondition{
		MatchType: "full_path",
		MatchValue: &matchValueCondition,
		Priority: int32(10),
	}
	ttlBrowserCacheRules:= int32(20)
	ttlUnitBrowserCacheRules:= "h"
	var listBrowserCacheRulesConfigs = []model.BrowserCacheRules{
        {
            Condition: conditionBrowserCacheRules,
            CacheType: "ttl",
            Ttl: &ttlBrowserCacheRules,
            TtlUnit: &ttlUnitBrowserCacheRules,
        },
    }
	conditionRequestUrlRewrite := &model.UrlRewriteCondition{
		MatchType: "full_path",
		MatchValue: "/test/*.jpg",
		Priority: int32(10),
	}
	redirectStatusCodeRequestUrlRewrite:= int32(301)
	redirectHostRequestUrlRewrite:= "http://www.example.com"
	var listRequestUrlRewriteConfigs = []model.RequestUrlRewrite{
        {
            Condition: conditionRequestUrlRewrite,
            RedirectStatusCode: &redirectStatusCodeRequestUrlRewrite,
            RedirectUrl: "/test/index.html",
            RedirectHost: &redirectHostRequestUrlRewrite,
            ExecutionMode: "redirect",
        },
    }
	serverNameSni:= "test.example.com"
	sniConfigs := &model.Sni{
		Status: "on",
		ServerName: &serverNameSni,
	}
	statusRequestLimitRules:= "on"
	matchValueRequestLimitRules:= "/test"
	var listRequestLimitRulesConfigs = []model.RequestLimitRules{
        {
            Status: &statusRequestLimitRules,
            Priority: int32(88),
            MatchType: "catalog",
            MatchValue: &matchValueRequestLimitRules,
            Type: "size",
            LimitRateAfter: int64(1024),
            LimitRateValue: int32(50),
        },
    }
	enableFlvByTimeSeekVideoSeek:= true
	startParameterVideoSeek:= "start"
	endParameterVideoSeek:= "end"
	videoSeekConfigs := &model.VideoSeek{
		EnableVideoSeek: true,
		EnableFlvByTimeSeek: &enableFlvByTimeSeekVideoSeek,
		StartParameter: &startParameterVideoSeek,
		EndParameter: &endParameterVideoSeek,
	}
	websocketConfigs := &model.WebSocketSeek{
		Status: "on",
		Timeout: int32(60),
	}
	var listAddCustomHeadersRulesRemoteAuthRules = []model.CustomArgs{
        {
            Type: "nginx_preset_var",
            Key: "http_host",
            Value: "$http_host",
        },
    }
	var listAddCustomArgsRulesRemoteAuthRules = []model.CustomArgs{
        {
            Type: "nginx_preset_var",
            Key: "http_host",
            Value: "$http_host",
        },
    }
	reserveHeadersRemoteAuthRules:= "sf"
	remoteAuthRulesRemoteAuth := &model.RemoteAuthRule{
		AuthServer: "https://192.168.0.0",
		RequestMethod: "GET",
		FileTypeSetting: "all",
		ReserveArgsSetting: "reserve_all_args",
		AddCustomArgsRules: &listAddCustomArgsRulesRemoteAuthRules,
		ReserveHeadersSetting: "reserve_specific_headers",
		AddCustomHeadersRules: &listAddCustomHeadersRulesRemoteAuthRules,
		AuthSuccessStatus: "200",
		AuthFailedStatus: "403",
		ResponseStatus: "403",
		Timeout: int32(500),
		TimeoutAction: "pass",
		ReserveHeaders: &reserveHeadersRemoteAuthRules,
	}
	remoteAuthConfigs := &model.CommonRemoteAuth{
		RemoteAuthentication: "on",
		RemoteAuthRules: remoteAuthRulesRemoteAuth,
	}
	var listBackSourcesFlexibleOrigin = []model.BackSources{
        {
            SourcesType: "domain",
            IpOrDomain: "www.back.example.com",
        },
    }
	var listFlexibleOriginConfigs = []model.FlexibleOrigins{
        {
            MatchType: "file_path",
            MatchPattern: "/test",
            Priority: int32(1),
            BackSources: listBackSourcesFlexibleOrigin,
        },
    }
	compressConfigs := &model.Compress{
		Status: "off",
	}
	typeForceRedirect:= "http"
	redirectCodeForceRedirect:= int32(301)
	forceRedirectConfigs := &model.ForceRedirectConfig{
		Status: "on",
		Type: &typeForceRedirect,
		RedirectCode: &redirectCodeForceRedirect,
	}
	valueReferer:= "192.168.0.0"
	includeEmptyReferer:= true
	refererConfigs := &model.RefererConfig{
		Type: "black",
		Value: &valueReferer,
		IncludeEmpty: &includeEmptyReferer,
	}
	valueIpFilter:= "192.168.0.0"
	ipFilterConfigs := &model.IpFilter{
		Type: "black",
		Value: &valueIpFilter,
	}
	matchTypeCacheRules:= "file_extension"
	matchValueCacheRules:= ".zip"
	ttlCacheRules:= int32(0)
	followOriginCacheRules:= "off"
	urlParameterTypeCacheRules:= "del_params"
	urlParameterValueCacheRules:= "test_param"
	var listCacheRulesConfigs = []model.CacheRules{
        {
            MatchType: &matchTypeCacheRules,
            MatchValue: &matchValueCacheRules,
            Ttl: &ttlCacheRules,
            TtlUnit: "h",
            Priority: int32(10),
            FollowOrigin: &followOriginCacheRules,
            UrlParameterType: &urlParameterTypeCacheRules,
            UrlParameterValue: &urlParameterValueCacheRules,
        },
    }
	httpPortSources:= int32(80)
	httpsPortSources:= int32(443)
	var listSourcesConfigs = []model.SourcesConfig{
        {
            OriginType: "domain",
            OriginAddr: "www.example.com",
            Priority: int32(70),
            HttpPort: &httpPortSources,
            HttpsPort: &httpsPortSources,
        },
    }
	urlAuthConfigs := &model.UrlAuth{
		Status: "off",
	}
	valueHttpResponseHeader:= "test_value"
	var listHttpResponseHeaderConfigs = []model.HttpResponseHeader{
        {
            Name: "test-name",
            Value: &valueHttpResponseHeader,
            Action: "set",
        },
    }
	valueOriginRequestHeader:= "test_value"
	var listOriginRequestHeaderConfigs = []model.OriginRequestHeader{
        {
            Name: "test-name",
            Value: &valueOriginRequestHeader,
            Action: "set",
        },
    }
	originProtocolConfigs:= "follow"
	originFollow302StatusConfigs:= "off"
	ipv6AccelerateConfigs:= int32(1)
	sliceEtagStatusConfigs:= "off"
	originReceiveTimeoutConfigs:= int32(30)
	configsbody := &model.Configs{
		OriginRequestHeader: &listOriginRequestHeaderConfigs,
		HttpResponseHeader: &listHttpResponseHeaderConfigs,
		UrlAuth: urlAuthConfigs,
		Sources: &listSourcesConfigs,
		OriginProtocol: &originProtocolConfigs,
		OriginFollow302Status: &originFollow302StatusConfigs,
		CacheRules: &listCacheRulesConfigs,
		IpFilter: ipFilterConfigs,
		Referer: refererConfigs,
		ForceRedirect: forceRedirectConfigs,
		Compress: compressConfigs,
		Ipv6Accelerate: &ipv6AccelerateConfigs,
		FlexibleOrigin: &listFlexibleOriginConfigs,
		SliceEtagStatus: &sliceEtagStatusConfigs,
		OriginReceiveTimeout: &originReceiveTimeoutConfigs,
		RemoteAuth: remoteAuthConfigs,
		Websocket: websocketConfigs,
		VideoSeek: videoSeekConfigs,
		RequestLimitRules: &listRequestLimitRulesConfigs,
		Sni: sniConfigs,
		RequestUrlRewrite: &listRequestUrlRewriteConfigs,
		BrowserCacheRules: &listBrowserCacheRulesConfigs,
		AccessAreaFilter: &listAccessAreaFilterConfigs,
		ClientCert: clientCertConfigs,
	}
	request.Body = &model.ModifyDomainConfigRequestBody{
		Configs: configsbody,
	}
	response, err := client.UpdateDomainFullConfig(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

204

Request succeeded.

Error Codes

See Error Codes.