Domain name for API request: gaap.tencentcloudapi.com.
This API (CreateRule) is used to create the forwarding rules of HTTP/HTTPS listeners.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: CreateRule. |
Version | Yes | String | Common Params. The value used for this API: 2018-05-29. |
Region | No | String | Common Params. This parameter is not required. |
ListenerId | Yes | String | Layer-7 listener ID |
Domain | Yes | String | Domain name of the forwarding rule |
Path | Yes | String | Path of the forwarding rule |
RealServerType | Yes | String | The origin server type of the forwarding rule, which supports IP and DOMAIN types. |
Scheduler | Yes | String | The strategy used by the listener to access the origin server. Values: rr (round-robin), wrr (weighted round-robin), lc (the least-connections strategy). |
HealthCheck | Yes | Integer | Whether the health check is enabled for rules. 1: enabled; 0: disabled. |
CheckParams | No | RuleCheckParams | Parameters related to origin server health check |
ForwardProtocol | No | String | Protocol types of the forwarding from acceleration connection to origin server, which supports HTTP or HTTPS. If this field is not passed in, it indicates that the ForwardProtocol of the corresponding listener will be used. |
ForwardHost | No | String | The host to which the acceleration connection forwards. If this parameter is not specified, the default host will be used, i.e., the host with which the client initiates HTTP requests. |
ServerNameIndicationSwitch | No | String | Whether to enable SNI. Values: on (enable), off (disable). For creation of HTTP listener forwarding rules, SNI is disabled by default. |
ServerNameIndication | No | String | Server Name Indication (SNI). This field is required when ServerNameIndicationSwitch is ON . |
ForcedRedirect | No | String | Enables HTTP-to-HTTPS force redirect for a forwarding rule. Enter a hostname and path of the current forwarding rule. |
Parameter Name | Type | Description |
---|---|---|
RuleId | String | The ID of the successfully created forwarding rule |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
This example shows you how to create an HTTP/HTTPS listener forwarding rule.
POST / HTTP/1.1
Host: gaap.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateRule
<Common request parameters>
{
"Domain": "www.bbb.com",
"RealServerType": "IP",
"HealthCheck": "1",
"ListenerId": "listener-9jt0rtv9",
"CheckParams": {
"ConnectTimeout": "4",
"Path": "%2F",
"Method": "HEAD",
"DelayLoop": "39",
"StatusCode": [
"300",
"100",
"400",
"200",
"500"
]
},
"Scheduler": "rr",
"Path": "%2Fimage"
}
{
"Response": {
"RequestId": "f3ab4984-dfe0-4c6f-aca0-32100550f6fd",
"RuleId": "rule-qws4fmyl"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
AuthFailure | CAM signature/authentication error. |
AuthFailure.NotEnterpriseAuthorization | Not an organizational customer. |
AuthFailure.UnauthorizedOperation | The sub-account is not authorized for this operation. |
FailedOperation | Operation failed. |
FailedOperation.ActionOperateTooQuickly | Too many attempts. Please try again later. |
FailedOperation.GroupStatusNotInRuning | Unable to operate: the connection group is not running. |
FailedOperation.InstanceStatusNotInRuning | Unable to operate: the connection is not running. |
FailedOperation.LimitNumofRules | Limit on the number of forwarding rules exceeded. |
FailedOperation.ListenerHasTask | The listener is in operation. Do not repeat the operation. |
FailedOperation.NonStandardProxy | This connection is non-standard and write operations are not allowed. |
FailedOperation.NotSupportOldVersionProxy | Only connections of Version 2.0 are supported. |
FailedOperation.RuleAlreadyExisted | Rule already exists. |
FailedOperation.UserNotConfirmProtocol | Protocol not activated. |
InternalError | Internal error. |
InvalidParameter | Incorrect parameter. |
InvalidParameterValue | Incorrect parameter value. |
MissingParameter | Missing parameter. |
ResourceNotFound | The resource does not exist. |
ResourceUnavailable.AccountViolation | Restricted resources found in your account. Check your inbox and email for details. |
UnauthorizedOperation | Unauthorized operation. |
本页内容是否解决了您的问题?