Docs
ulb
Application Load Balancer ALB
Operation Guide
Listeners
Content Forwarding

Content Forwarding

Listeners support matching domain names or access paths according to content forwarding rules, and can forward matched requests to specific hosts in the backend, for fine management of backend service nodes. Content forwarding rules are divided into “domain forwarding” and “path forwarding”. Both of these forwarding methods can use regular expressions that comply with PCRE rules to describe, such as “www.[123].demo.com”, “..demo.com” or “/path/img/..jpg”. When creating a rule, the rule content cannot be empty and cannot contain escape characters.

Add Content Forwarding Rules

By default, there will be one Default rule strategy. This strategy takes effect when all requests fail to match successfully and will be matched to the Default rule for forwarding.

  1. Log in to the application load balancing ALB console.
  2. In the top menu bar, select the region of the ALB instance.
  3. Choose one of the following methods to open the listener configuration.
    1. On the Instance List page, click Listener Management in the Operation column of the target instance.
    2. On the Instance List page, click the target instance ID or details. On the Listener Management tab, enter the listener details page.
  4. In the Listener Details page, select the Content Forwarding tab.

​ 5. Click Add Rules in the upper left corner, and edit the following content on the rule addition page.

| Forwarding Type | Domain Forwarding | Limit the length of the forwarding domain to not exceed 255 characters, and the single-level length does not exceed 63 characters;
The regular expression supports Chinese, letters, numbers and special characters. - ? = ~ _ - + ^ * ! $ : & | ( ) [ ] . (Here ”:” can only be used in the form of adding a port after the domain name, and it is used in non-80 port HTTP and non-443 port HTTPS scenes)
The wildcard domain name supports Chinese, letters, numbers and special characters. : * _ - .
_ Cannot appear at the beginning or end.
Wildcard domain names currently only support * . Or . At the beginning or . * Or . At the end, and only * is supported in a single domain name. | | Path Forwarding | 1-255 characters. Support Chinese, letters, numbers and special characters. - _ / = ? ^ * $ ! : ( ) [ ] + | | 1-255 characters.
Support Chinese, letters, numbers and special characters. - _ / = ? ^ * $ ! : ( ) [ ] + | | | Forwarding Conditions | Regular | Support regular expressions, for example: www.[123].demo.com can match www.1.demo.comwww.2.demo.comwww.3.demo.com etc., domain names. | | | Wildcard | Support wildcard matching, for example: .demo.com or .demo.com can match all domain names ending with demo.com, www.demo. or www.demo. can match all domain names starting with www.demo .
/path/img/.*.jpg can match all files ending with jpg under the /path/img/ path, such as /path/img/demo.jpg, /path/img/1/demo.jpg, etc. | | Actions | Select Nodes | Each rule needs to be associated with an existing service node. Select the node to be linked. |

  1. Click OK to complete the configuration of the content forwarding rule.

Manage Content Forwarding Rules

After adding a content forwarding rule, you can edit the node or action associated with the current rule.

  1. Log in to the application load balancing ALB console.
  2. In the top menu bar, select the region of the ALB instance.
  3. Choose one of the following methods to open the listener configuration.
    1. On the Instance List page, click Listener Management in the Operation column of the target instance.
    2. On the Instance List page, click the target instance ID or details. On the Listener Management tab, enter the listener details page.
  4. In the Listener Details page, select the Content Forwarding tab to enter the Content Forwarding page.
  5. Select the content forwarding rule you want to edit, click Manage in the operation column, and enter the rule editing page.
  1. Supports editing the forwarding type, forwarding content, and actions of the rule.

Delete Content Forwarding Rules

After adding content forwarding rules, you can edit the nodes or actions associated with the current rules.

  1. Log in to the application load balancing ALB console.
  2. In the top menu bar, select the region of the ALB instance.
  3. Choose one of the following methods to open the listener configuration.
    1. On the Instance List page, click Listener Management in the Operation column of the target instance.
    2. On the Instance List page, click the target instance ID or details. On the Listener Management tab, enter the listener details page.
  4. In the Listener Details page, select the Content Forwarding tab to enter the Content Forwarding page.
  5. Select the content forwarding rule you want to delete.
  1. Click Delete in the operation column, or click Delete Rule in the upper left corner.

  2. In the rule deletion confirmation pop-up, click OK to delete the rule.

Match policy

Forwarding rule priority: The matching policy is sorted according to the time the forwarding rule is added. The priority is from high to low, and the later the rule is added, the higher the priority.

If the same domain name is configured in different forwarding rules, the rules with the same domain name will be aggregated and matched and forwarded according to the highest priority rule set by the domain name.

If the request matches the domain name, but the rule does not configure the request path information, then the ALB will return 404 to the client.

Default forwarding rule: After creating the listener, the system will automatically create a default forwarding rule. This forwarding rule matches all client requests; it is forwarded to the set backend service node.

Default forwarding rule description: The default forwarding rule does not support deletion and supports changing the backend service node for forwarding. The priority of the default forwarding rule is the lowest.