edit-icon download-icon

CreateRules

Last Updated: Apr 12, 2018

Description

Add forwarding rules to the specified listener.

Request parameters

Name Type Required Description
Action String Yes

The action to perform. Valid value:

CreateRules

RegionId String Yes The region ID of the Server Load Balancer instance.
LoadBalancerId String Yes The ID of the Server Load Balancer instance.
ListenerPort String Yes

The front-end listening port of the Server Load Balancer instance.

Valid value: 1-65535

RuleList String Yes

The rules to be added.

Note: You can add up to 10 forwarding rules in one request.

RuleList objects
RuleName String Yes

The name of the forwarding rule.

It can contain 1 to 80 characters and can only contain letters, numbers, dashes, slashes, dots, and sublines.

Note: The names of different rules in a listener must be unique.

Domain String No

The domain name in the request.

It can only contain letters, numbers, dashes, or dots.

Url String No

The URL.

It can contain 1 to 80 characters, and can contain only letters, numbers, dashes, slashes, dots, percent signs, question marks, number signs, or ampersands.

Note: You must specify a domain name or a URL, or both of them. The combination of the domain name and the URL must be unique in a listener. For more information, see Configure domain name or URL based forwarding rules.

VServerGroupId String Yes The ID of the VServer group associated with the forwarding rule.

Response parameters

Name Type Description
RequestId String The ID of the request.
Rules JSON String The list of forwarding rules.
RuleList objects
RuleId String The ID of the forwarding rule.
RuleName String The name of the forwarding rule.

Examples

Request example

  1. https://slb.aliyuncs.com/?<Common parameters>
  2. &Action=CreateRules
  3. &RegionId=cn-east-hangzhou-01
  4. &LoadBalancerId=152a602e315-cn-beijing-btc-a01
  5. &ListenerPort=80
  6. &RuleList=[
  7. {"RuleName":"Rule1","Domain":"abcdefg.com","Url":"/image","VServerGroupId":"Group1"},
  8. {"RuleName":"Rule2","Domain":"abcdefg.com","Url":"/cache","VServerGroupId":"Group2"},
  9. ]

Response example

  • XML format

    1. <?xml version="1.0" encoding="utf-8"?>
    2. <CreateRules>
    3. <RequestId>9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C</RequestId>
    4. <Rules>
    5. <Rule>
    6. <RuleId>rule-3ejhktkaeu<RuleId>
    7. <RuleName>Rule1<RuleName>
    8. </Rule>
    9. <Rule>
    10. <RuleId>rule-tybqi6qkp8<RuleId>
    11. <RuleName>Rule2<RuleName>
    12. </Rule>
    13. </Rules>
    14. </CreateRules>
  • JSON format

    1. {
    2. "RequestId":"9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C",
    3. "Rules":{
    4. "Rule":[
    5. {'RuleId':'rule-3ejhktkaeu','RuleName':'Rule1'},
    6. {'RuleId':'rule-tybqi6qkp8','RuleName':'Rule2'}
    7. ]
    8. }
    9. }
Thank you! We've received your feedback.