If advanced forwarding is not enabled, perform the following operations to add forwarding policies to HTTP or HTTPS listeners of dedicated load balancers.
You can add forwarding policies to HTTP or HTTPS listeners to forward requests to different backend server groups based on domain names or URLs.
This is suited for applications that are deployed on multiple backend servers and provide multiple types of services such as videos, images, audios, and texts.
Alternatively, click Forwarding Policies on the right of the page.
Parameter |
Description |
Example Value |
|
---|---|---|---|
Forwarding Rule |
Domain name |
Specifies the domain name used for forwarding requests. The domain name in the request must exactly match that in the forwarding policy. You need to specify either a domain name or URL. NOTE:
Advanced forwarding policies support wildcard domain names. For details, see Advanced Forwarding. |
www.test.com |
URL |
Specifies the URL used for forwarding requests. There are three URL matching rules: |
/login.php |
|
Action |
Forward to a backend server group |
If the request matches the configured forwarding rule, the request is forwarded to the specified backend server group. |
Forward to a backend server group |
Redirect to another listener |
If the request matches the configured forwarding rule, the request is redirected to the specified HTTPS listener. This action can be configured only for HTTP listeners. NOTE:
If you select Redirect to another listener and create a redirect for the current listener, this listener will not route requests and will redirect the requests to the specified HTTPS listener, but access control configured for the listener will still take effect. For example, if you configure a redirect for an HTTP listener, HTTP requests to access a web page will be redirected to the HTTPS listener you select and handled by the backend servers associated with the HTTPS listener. As a result, the clients access the web page over HTTPS. |
- |
|
Backend Server Group |
Select a backend server group that will receive requests from the load balancer. This parameter is mandatory when you set Action to Forward to a backend server group. |
- |
|
Listener |
Select an HTTPS listener that will receive requests redirected from the current HTTP listener. This parameter is mandatory when Action is set to Redirect to another listener. |
- |
Table 2 shows an example of URL matching.
URL Matching Rule |
URL |
URL in the Forwarding Policy |
|||
---|---|---|---|---|---|
- |
- |
/elb/index.html |
/elb |
/elb[^\s]* |
/index.html |
Exact match |
/elb/index.html |
√ |
- |
- |
- |
Prefix match |
√ |
√ |
- |
- |
|
Regular expression match |
√ |
- |
√ |
- |
Figure 1 shows an example of how a URL is matched and requests are forwarded.
In this example, the request URL /elb_gls/glossary.html is searched using the Exact match rule first. 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 based on the URL. Although the request URL matches rule 3 in Regular expression match, the request is forwarded to backend server group 2 because of the higher priority of Prefix match.
Alternatively, click Forwarding Policies in the right pane.
You can delete a forwarding policy if you no longer need it.
Deleted forwarding policies cannot be recovered.
Alternatively, click Forwarding Policies in the right pane.