Adds a domain name to Web Application Firewall (WAF).
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
yundun-waf:CreateDomain | create | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceId | string | Yes | The ID of the Web Application Firewall (WAF) instance. Note
You can call the DescribeInstance operation to obtain the ID of the WAF instance.
| waf_cdnsdf3**** |
ResourceManagerResourceGroupId | string | No | The ID of the resource group. | rg-acfm***q |
Domain | string | Yes | The domain name that you want to add to WAF. | www.aliyundoc.com |
Listen | object | Yes | The configurations of the listeners. | |
HttpsPorts | array | No | The HTTPS listener port. | |
integer | No | The HTTPS listener ports. Specify the ports in the [port1,port2,...] format. | [443,8443] | |
HttpPorts | array | No | The HTTP listener port. | |
integer | No | The HTTP listener ports. Specify the ports in the [port1,port2,...] format. | [80,81] | |
Http2Enabled | boolean | No | Specifies whether to enable HTTP/2. This parameter is available only if you specify HttpsPorts. Valid values:
| true |
CertId | string | No | The ID of the certificate that you want to add. This parameter is available only if you specify HttpsPorts. | 123 |
SM2Enabled | boolean | No | Specifies whether to enable the ShangMi (SM) certificate. | true |
SM2CertId | string | No | The ID of the SM certificate that you want to add. This parameter is available only if you set SM2Enabled to true. | 123-cn-hangzhou |
SM2AccessOnly | boolean | No | Specifies whether to allow access only from SM certificate-based clients. This parameter is available only if you set SM2Enabled to true.
| true |
TLSVersion | string | No | The version of the Transport Layer Security (TLS) protocol. This parameter is available only if you specify HttpsPorts. Valid values:
| tlsv1 |
EnableTLSv3 | boolean | No | Specifies whether to support TLS 1.3. This parameter is available only if you specify HttpsPorts. Valid values:
| true |
CipherSuite | integer | No | The type of cipher suite that you want to add. This parameter is available only if you specify HttpsPorts. Valid values:
| 2 |
CustomCiphers | array | No | The custom cipher suite that you want to add. | |
string | No | The custom cipher suites that you want to add. This parameter is available only if you set CipherSuite to 99. | ["xxx","ffas"] | |
FocusHttps | boolean | No | Specifies whether to enable HTTP to HTTPS redirection. This parameter is available only if you specify HttpsPorts and leave HttpPorts empty. Valid values:
| true |
XffHeaderMode | integer | No | The method that you want WAF to use to obtain the actual IP address of a client. Valid values:
| 1 |
XffHeaders | array | No | The custom header field that you want WAF to use to obtain the actual IP address of a client. | |
string | No | The custom header fields that you want WAF to use to obtain the IP address of a client. Specify the fields in the ["header1","header2",...] format. Note
This parameter is required only if you set XffHeaderMode to 2.
| ["Client-ip","cip"] | |
IPv6Enabled | boolean | No | Specifies whether to enable IPv6. Valid values:
| true |
ProtectionResource | string | No | The type of the protection resource. Valid values:
| share |
ExclusiveIp | boolean | No | Specifies whether to enable an exclusive IP address. This parameter is available only if you set IPv6Enabled to false and ProtectionResource to share. Valid values:
| true |
Redirect | object | Yes | The configurations of the forwarding rule. | |
Backends | array | No | The IP addresses or domain names of the origin server. | |
string | No | The IP address or domain name of the origin server. You can use only one of the address types. If you use the domain name type, the domain name can be resolved only to an IPv4 address.
| [ "1.1.XX.XX", "2.2.XX.XX" ] | |
Loadbalance | string | Yes | The load balancing algorithm that you want to use to forward requests to the origin server. Valid values:
| roundRobin |
FocusHttpBackend | boolean | No | Specifies whether to enable HTTPS to HTTP redirection for back-to-origin requests. This parameter is available only if you specify HttpsPorts. Valid values:
| true |
SniEnabled | boolean | No | Specifies whether to enable origin Server Name Indication (SNI). This parameter is available only if you specify HttpsPorts. Valid values:
| true |
SniHost | string | No | The value of the SNI field. If you do not specify this parameter, the value of the Host field is automatically used. This parameter is optional. If you want WAF to use an SNI field value that is different from the Host field value in back-to-origin requests, you can specify a custom value for the SNI field. Note
This parameter is required only if you set SniEnabled to true.
| www.aliyundoc.com |
RequestHeaders | array<object> | No | The custom header field that you want to use to label requests that are processed by WAF. When a request passes through WAF, the custom header field is automatically used to label the request. This way, the backend service can identify requests that are processed by WAF. | |
object | No | Specify the value of this parameter in the [{"k":"key","v":"value"}]** format. key specifies a custom header field. **value** specifies the value of the field. | ||
Key | string | No | The custom header field. | aaa |
Value | string | No | The value of the custom header field. | bbb |
ConnectTimeout | integer | No | The timeout period for connections. Unit: seconds. Valid values: 1 to 3600. | 120 |
ReadTimeout | integer | No | The timeout period for read connections. Unit: seconds. Valid values: 1 to 3600. | 200 |
WriteTimeout | integer | No | The timeout period for write connections. Unit: seconds. Valid values: 1 to 3600. | 200 |
CnameEnabled | boolean | No | Specifies whether to enable the public cloud disaster recovery feature. Valid values:
| true |
RoutingRules | string | No | The forwarding rules that you want to configure for the domain name that you want to add to WAF in hybrid cloud mode. This parameter is a string that consists of JSON arrays. Each element in a JSON array is a JSON struct that contains the following fields:
| [ { "rs": [ "1.1.XX.XX" ], "locationId": 535, "location": "test1111" } ] |
Keepalive | boolean | No | Specifies whether to enable the persistent connection feature. Valid values:
| true |
Retry | boolean | No | Specifies whether WAF retries forwarding requests to the origin server when the requests fail to be forwarded to the origin server. Valid values:
| true |
KeepaliveRequests | integer | No | The number of reused persistent connections. Valid values: 60 to 1000. Note
This parameter specifies the number of reused persistent connections after you enable the persistent connection feature.
| 1000 |
KeepaliveTimeout | integer | No | The timeout period for idle persistent connections. Valid values: 1 to 60. Default value: 15. Unit: seconds. Note
This parameter specifies the time for which a reused persistent connection can remain in the Idle state before the persistent connection is closed.
| 15 |
XffProto | boolean | No | Specifies whether to use X-Forward-For-Proto to pass the protocol used by WAF to forward requests to the origin server. Valid values:
| true |
RegionId | string | Yes | The region where the WAF instance resides. Valid values:
| cn-hangzhou |
AccessType | string | No | The mode in which you want to add the domain name to WAF. Valid values:
| share |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "D7861F61-5B61-46CE-A47C-6B19160D****",
"DomainInfo": {
"Cname": "xxxxxwww.****.com",
"Domain": "www.aliyundoc.com"
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-01-30 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2023-04-27 | The request parameters of the API has changed | View Change Details |
2023-04-18 | The request parameters of the API has changed | View Change Details |
2023-03-31 | The request parameters of the API has changed | View Change Details |