Creates a forwarding rule for a website.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateWebRule

The operation that you want to perform. Set the value to CreateWebRule.

Domain String Yes www.aliyun.com

The domain name of the website.

RsType Integer Yes 0

The address type of the origin server. Valid values:

  • 0: IP address
  • 1: domain name
Rules String Yes [{"ProxyRules":[{"ProxyPort":80,"RealServers":["1.1.1.1"]}],"ProxyType":"http"},{"ProxyRules":[{"ProxyPort":443,"RealServers":["1.1.1.1"]}],"ProxyType":"https"}]

Details about the forwarding rule. This parameter is a JSON string. The fields in the value are described as follows:

  • ProxyRules: the protocol information. This field is required and must be of the ARRAY type.
    • ProxyPort: the port number. It is required and must be of the INTEGER type.
    • RealServers: the address of the origin server. It is required and must be of the ARRAY type.
  • ProxyType: the protocol type. It is required and must be of the STRING type. Valid values:
    • http
    • https
    • websocket
    • websockets
RegionId String No cn-hangzhou

The region ID of the instance. Valid values:

  • cn-hangzhou: mainland China, which indicates an Anti-DDoS Pro instance
  • ap-southeast-1: outside mainland China, which indicates an Anti-DDoS Premium instance
ResourceGroupId String No default

The ID of the resource group to which the instance belongs in Resource Management. This parameter is empty by default, which indicates that the instance belongs to the default resource group.

InstanceIds.N RepeatList No ddoscoo-cn-mp91j1ao****

The ID of instance N. If this parameter is not specified, only a domain name is added but no instance is associated with the website.

Note You can call the DescribeInstanceIds operation to query the IDs of all instances.

Response parameters

Parameter Type Example Description
RequestId String 0bcf28g5-d57c-11e7-9bs0-d89d6717dxbc

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/? Action=CreateWebRule
&Domain=www.aliyun.com
&RsType=0
&Rules=[{"ProxyRules":[{"ProxyPort":80,"RealServers":["1.1.1.1"]}],"ProxyType":"http"},{"ProxyRules":[{"ProxyPort":443,"RealServers":["1.1.1.1"]}],"ProxyType":"https"}]
&<Common request parameters>

Sample success responses

XML format

<CreateWebRuleResponse>
      <RequestId>0bcf28g5-d57c-11e7-9bs0-d89d6717dxbc</RequestId>
</CreateWebRuleResponse>

JSON format

{
  "RequestId": "0bcf28g5-d57c-11e7-9bs0-d89d6717dxbc"
}

Error codes

For a list of error codes, visit the API Error Center.