Adding a Forwarding Rule
Function
This API is used to add a forwarding rule. After you add a forwarding rule, the load balancer matches the domain name and path in the request and distributes the traffic to the backend server group specified by redirect_pool_id of the associated forwarding policy.
Constraints
The match type of forwarding rules in a forwarding policy must be unique.
URI
POST /v2/{project_id}/elb/l7policies/{l7policy_id}/rules
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the project ID. |
l7policy_id |
Yes |
String |
Specifies the forwarding policy ID. |
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
rule |
Yes |
Rule object |
Specifies the forwarding rule. For details, see Table 3. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tenant_id |
No |
String |
Specifies the ID of the project where the forwarding rule is used. The value must be the same as the value of project_id in the token. The value contains a maximum of 255 characters. |
admin_state_up |
No |
Boolean |
Specifies the administrative status of the forwarding rule. This parameter is reserved, and the default value is true. |
type |
Yes |
String |
Specifies the match type of a forwarding rule. The value range varies depending on the protocol of the backend server group:
The match type of forwarding rules in a forwarding policy must be unique. |
compare_type |
Yes |
String |
Specifies the match mode. The options are as follows: When type is set to HOST_NAME, the value of this parameter can only be the following:
When type is set to PATH, the value of this parameter can be one of the following:
|
invert |
No |
Boolean |
Specifies whether reverse matching is supported. The value can be true or false. The default value is false. This parameter is reserved. |
key |
No |
String |
Specifies the key of the match content. The default value is null. This parameter is reserved. The value contains a maximum of 255 characters. |
value |
Yes |
String |
Specifies the value of the match content. The value cannot contain spaces. The value contains a maximum of 128 characters.
|
Response
Parameter |
Type |
Description |
---|---|---|
rule |
Rule object |
Specifies the forwarding rule. For details, see Table 5. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the forwarding rule ID. |
tenant_id |
String |
Specifies the ID of the project where the forwarding rule is used. The value contains a maximum of 255 characters. |
project_id |
String |
Specifies the ID of the project to which the forwarding rule belongs. This parameter has the same meaning as tenant_id. |
admin_state_up |
Boolean |
Specifies the administrative status of the forwarding rule. This parameter is reserved. The value can be true or false.
|
type |
String |
Specifies the match type of a forwarding rule. The value range varies depending on the protocol of the backend server group:
|
compare_type |
String |
Specifies the match mode. The options are as follows: When type is set to HOST_NAME, the value of this parameter can only be the following:
When type is set to PATH, the value of this parameter can be one of the following:
|
invert |
Boolean |
Specifies whether reverse matching is supported. The value can be true or false. The default value is false. This parameter is reserved. |
key |
String |
Specifies the key of the match content. The default value is null. This parameter is reserved. The value contains a maximum of 255 characters. |
value |
String |
Specifies the value of the match content. The value contains a maximum of 128 characters.
|
provisioning_status |
String |
This parameter is reserved, and its value can only be ACTIVE. It specifies the provisioning status of the forwarding rule. |
Example Request
- Example request: Adding a forwarding rule
POST https://{endpoint}/v2/a31d2bdcf7604c0faaddb058e1e08819/elb/l7policies/5ae0e1e7-5f0f-47a1-b39f-5d4c428a1586/rules { "rule": { "compare_type": "EQUAL_TO", "type": "PATH", "value": "/bbb.html" } }
Example Response
- Example response
{ "rule": { "compare_type": "EQUAL_TO", "admin_state_up": true, "provisioning_status": "ACTIVE", "tenant_id": "a31d2bdcf7604c0faaddb058e1e08819", "project_id": "a31d2bdcf7604c0faaddb058e1e08819", "invert": false, "value": "/bbb.html", "key": null, "type": "PATH", "id": "c6f457b8-bf6f-45d7-be5c-a3226945b7b1" } }
Status Code
For details, see Status Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot