Updated on 2023-12-18 GMT+08:00

Adding a Forwarding Rule

API Format

Method

URI

Description

POST

/v2.0/lbaas/l7policies/{l7policy_id}/rules

Adds a forwarding rule.

Constraints

The type of forwarding rules for the same forwarding policy cannot be the same.

Procedure

  1. Set the request header. Set the header in Postman and place the obtained token in the header.
  2. Create a forwarding rule for the request whose name starts with /music.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/l7policies/5b94fb42-b018-4ad6-9ba6-0e8a509c6821/rules
    { 
        "rule": { 
            "compare_type": "STARTS_WITH",  
            "type": "PATH",  
            "value": "/music" 
        } 
    }

  3. Create a forwarding rule for the request whose name starts with /pic.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/l7policies/f6c5862d-460c-4ab6-8dc7-2294df442f67/rules
    { 
        "rule": { 
            "compare_type": "STARTS_WITH",  
            "type": "PATH",  
            "value": "/pic" 
        } 
    }

  4. Check the created forwarding rules on the web console.