• Elastic Load Balancing

elb
  1. Help Center
  2. Elastic Load Balancing
  3. User Guide
  4. Management
  5. Forwarding Policy

Forwarding Policy

Scenarios

Enhanced load balancers allow you to add forwarding policies to forward requests from different clients to backend server groups based on the domain names or URLs specified in the forwarding policies. Currently, you can add forwarding policies only to HTTP or HTTPS listeners.

You can add a maximum of 20 forwarding policies. This allows you to easily forward video, image, audio, and text requests to different backend server groups, improving the flexibility of service traffic distribution and facilitating resource allocation.

After a forwarding policy is added, the load balancer will forward frontend requests based on the following rules:

  • If the forwarding policy is matched, the request is forwarded to the backend server group based on this forwarding policy.
  • If the forwarding policy is not matched, the request is forwarded to the default backend server group of the listener.

Add a Forwarding Policy

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Locate the target load balancer and click its name.
  5. Click Listeners, locate the target listener, and click its name.
  6. Click Add on the right of Forwarding Policies.
  7. In the Add Forwarding Policy dialog box, set the parameters by referring to Table 1.
  8. Click OK.

    Alternatively, locate the target listener in the load balancer list and click its name to switch to the Listeners area. Click Add on the right of Forwarding Policies and then add a forwarding policy.

Table 1 Forwarding policy parameters

Item

Parameter

Description

Example Value

Configure Forwarding Policy

Name

Specifies the forwarding policy name.

forwarding_policy-q582

Domain Name

Specifies the domain name for triggering the forwarding. Only exact match domain names are supported. Note that at least one domain name or URL must be specified.

www.test.com

URL

Specifies the URL for triggering the forwarding.

/login.php

URL Mapping Rule

  • Exact match

    The request URL is identical to the preset URL.

  • Prefix match

    The request URL matches the header of the preset URL.

  • Regular expression match
    The request URL matches the preset URL using the regular expression.
    NOTE:

    The matching priority is as follows: Exact match > Prefix match > Regular expression match.

Exact match

Description

Provides supplementary information about the forwarding policy.

N/A

Add Backend Server Group

Backend Server Group

Specifies whether a new or existing backend server group will be used. You can select Create new or Use existing. If you select Create new, set parameters by referring to Table 2 and Table 3. If you select Use existing, select an existing backend server group for the forwarding policy.

NOTE:

The backend protocol can only be HTTP.

Create new

URL Matching Example

The following table shows how a URL is matched, and Figure 1 illustrates how a request is forwarded to a backend server group.

Table 2 URL matching

URL Mapping Rule

Request URL

Preset URL

-

-

/elb/index.html

/elb

/elb[^\s]*

/index.html

Exact match

/elb/index.html

-

-

-

Prefix match

-

-

Regular expression match

-

-

Figure 1 Request forwarding

In this figure, the system first searches the request URL (/elb_gls/glossary.html) using the Exact match rule. If no precisely matched URL is found, the Prefix match rule is used. If a URL matches the prefix of the request URL, the request is forwarded to backend server group 2. Even if the request URL also matches rule 3 (Regular expression match), the request is forwarded to backend server group 2 because Prefix match enjoys higher priority.

Modify a Forwarding Policy

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Locate the target load balancer and click its name.
  5. Click Listeners, locate the target listener, and click its name.
  6. Click Forwarding Policies.
  7. Locate the target forwarding policy and click on the right.
  8. In the Modify Forwarding Policy dialog box, modify the parameters and click OK.

Delete a Forwarding Policy

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Locate the target load balancer and click its name.
  5. Click Listeners, locate the target listener, and click its name.
  6. Click Forwarding Policies.
  7. Locate the target forwarding policy and click on the right.
  8. In the Delete Forwarding Policy dialog box, click Yes.