- Documentation
Load Balancer
Classic Load Balancer (CLB)
User Guide
Listener
Configuring a forwarding rule
Forwarding rule description
Configuring a forwarding rule
Forwarding rule description
Forwarding rule description
Forwarding rules are used to direct requests for specified domain names and URLs to designated backend server groups.
You can configure multiple forwarding rules for one Layer 7 listener.
After August 30, 2021:
- Newly created listeners must have a default forwarding rule to forward requests that do not match any rule.
- Existing listeners: Please refer to Creating a listener to configure the default Server Group for a Layer 7 listener. Otherwise, you will not be able to modify other attributes of the listener, and you will not be able to create forwarding rules with an empty domain name.
Domain name and URL
- Domain name supports two configuration modes: precise domain name and wildcard domain name.
- Exact domain name: An exact domain name that complies with domain name specifications. For example www.test.com
- Wildcard domain: Use wildcard * to replace one or more characters, * is only supported at the beginning or end of a domain name, it can only appear once per domain name, and can only be placed around . Allowed placement before or after the <a i=3>.</a>
- Allowed formats: *.test.com, www.test.*
- Disallowed formats: www.*.com, *.test.*, *.*.com, *aaa.com
- URL paths start with /, e.g., /, /abc/read. If not configured, the default is /.
- You can configure the domain name only, URL only, or both domain name and URL according to your business needs.
- If only the domain name is configured, the URL defaults to /, meaning it forwards requests matching any URL under that domain name. For example, if the domain name is configured as www.test.com, requests to www.test.com/lb/ or www.test.com/lb/create will both match this forwarding rule.
- If only the URL is configured, the domain name defaults to empty, meaning it forwards requests matching that URL on any domain. For example, if the URL is set to /lb, requests to www.test.com/lb or www.test.cn/lb will both match this forwarding rule.
- If both the domain name and URL are configured, it forwards requests that match both the specified domain name and URL.
Matching description
- When the Layer 7 listener receives a request, it forwards the request to the corresponding backend server group by matching the domain name and URL based on the forwarding rule configuration. The matching process is as follows:
- If the received request contains a domain name, domain matching is performed in the priority order of exact domain name > wildcard domain starting with * > wildcard domain ending with *
- If a matching domain name exists, continue matching the URL according to the longest match principle.
- If a matching URL exists, forward the request to the backend server group of the corresponding rule.
- If there is no matching URL, forward the request to the backend server group of the default forwarding rule.
- If no matching domain name exists, continue matching forwarding rules with "no domain name, URL path only" based on the longest match principle.
- If a matching URL exists, forward the request to the backend server group of the corresponding rule.
- If there is no matching URL or no forwarding rule with "no domain name, URL path only," forward the request to the backend server group of the default forwarding rule.
tip
Domain matching for forwarding rules is case-insensitive, while URL matching is case-sensitive. When configuring forwarding rules for a Layer 7 listener, configure the URLs with the correct case according to the actual URLs.
- For example, a Layer 7 listener has the following forwarding rules configured in sequence:
- The matching rules for the following requests are as follows:
Last updated: 2026.08.06 14:31:17