Create a Forwarding Rule

On the main menu of ZStack Cloud, choose Resource Center > Network Service > Basic Network Service > Load Balancing. On the load balancer management page, click the target load balancer. On the details page of the load balancer, click the Listener tab. On the tab, click the target listener to go to the details page. On the page, click the Forwarding Rule tab. On the tab, click Add Forwarding Rule. Then, the Add Forwarding Rule page appears.

On the displayed page, set the following parameters:
  • Domain Name: Optional. Enter the domain name that you need to forward. The domain name must be 0-125 characters in length and can contain letters, digits, hyphens (-), periods (.), and asterisks (*).
    Note: Consider the following when you use an asterisk (*) in a generic domain name:
    • Put the asterisk (*) in the first place of the domain name.
    • Do not fill in only asterisks (*) for the domain name.
    • Supported formats: *.example.com and *example.com.
  • URL: Optional. Enter a request URL. The URL must be 0-80 characters in length and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), percent signs (%), question marks (?) number signs (#), and ampersands (&).
  • Backend Server Group: Select a backend server group that you want to associate the rule with.
  • Description: Optional. Enter a description for the forwarding rule.
Note:
  • You must enter a domain name, URL, or both.
  • You can add a forwarding rule by clicking Add Rule or Add Domain Name. A listener can be associated a maximum of 40 forwarding rules.
Figure 1. Forwarding Rule


Forwarding Rule Matching Algorithm

Forwarding rules are matched based on the following algorithm:
    • If the domain name is specified, the system attempts to match URLs:
      • If a URL is matched, the request is forwarded to the associated backend server group. If multiple URLs are matched based on the exact match mechanism, the request is forwarded to the backend server group associated with the URL that is matched most accurately.
      • If the specified URLs of the domain name are not matched, the request is forwarded to the backend server group associated with the root URL.
      • If the root URL is not configured, errors are returned.
    • If the domain name is not specified in the frontend request or no domain name is matched, the system attempts to match forwarding rules that have their domain names unspecified:
      • If a forwarding rule is matched, the request is forwarded to the associated backend server group.
      • If no forwarding rule is matched, the request is forwarded to the backend server group that is not associated with any rule.
      • If all backend server groups associated with the listener have associated forwarding rules, errors are returned.