The business flows of layer-7 and layer-4 CLB (formerly application CLB) are as shown below:
If layer-7 CLB is used to forward HTTP/HTTPS protocols, you can add a corresponding domain name when creating the forwarding rule in a CLB listener.
Layer-7 CLB can forward requests from different domain names and URLs to different servers for processing. A layer-7 listener can be configured with multiple domain names, each of which can be configured with multiple forwarding paths.
www.example.*, that is, wildcard domain names begin or end with
*which appears only once.
~which can appear only once.
example.qcould.comas an example, the format is as follows:
example.qcloud.comexactly matches the
*.qcloud.commatches all domain names ending with
example.qcloud.*matches all domain names beginning with
URL ~*.(gif|jpg|bmp)$. in the forwarding group, hopefully it will match any files that end with gif, jpg, or bmp.
If a client request cannot be matched with any domain name of this listener, CLB will forward the request to the default domain name (
Default Server) to make the default rule controllable. Only one default domain name can be configured under one listener.
For example, the
HTTP:80 listener of CLB instance 1 is configured with two domain names:
www.test1.com is the default domain name. When a user visits
www.example.com, since no domain name is matched, CLB will forward the request to the default domain name
- Before May 18, 2020, the default domain name is optional for layer-7 listeners.
- If your layer-7 listener has a default domain name configured, client requests that do not match other rules will be forwarded to it.
- If your layer-7 listener has no default domain name configured, client requests that do not match other rules will be forwarded to the first domain name loaded by CLB (its loading order may be different from that configured in the console; therefore, it may not be the first one configured in the console).
- Starting from May 18, 2020:
- All new layer-7 listeners must have a default domain name configured: the first rule of a layer-7 listener must enable the default domain name. When an API is called to create a layer-7 rule, CLB will automatically set the
- For all listeners that have a default domain name configured, you need to specify a new default domain name when modifying or deleting the existing default domain name: when you perform the operation in the console, you need to specify a new default domain name; when you perform the operation by calling an API, if you do not set a new default domain name, CLB will set the earliest-created one among the remaining domain names as the new default domain name.
- For existing rules without a default domain name, you can directly configure a default domain name based on your business needs as instructed in operation 4 below. If you don't do so, Tencent Cloud will set the first domain name loaded by CLB as the default domain name. This operation has no impact on the business. Existing listeners will be all processed before June 19, 2020.
The above policy will be implemented gradually starting from May 18, 2020, and the effective date for each instance may vary slightly. As of June 20, 2020, all layer-7 listeners that have a forwarded domain name will have a default domain name.
The following four operations can be performed on the default domain name:
Layer-7 CLB can forward requests from different URLs to different servers for processing, and multiple forwarded URL paths can be configured for a single domain name.
/., with valid character sets including
~which can appear only once.
=indicates exact match.
^~indicates that the URL starts with a regular string and is not for regex match.
~indicates case-sensitive regex match.
~*indicates case-insensitive regex match.
/indicates generic match, where any requests will be matched if there are no other matches.
example.qloud.com/test1/image/index1.htmlexactly matches the URL rule configured by forwarding rule 1, the request will be forwarded to the real servers associated with forwarding rule 1, i.e., port 80 of CVM1 and CVM2 in the figure.
example.qloud.com/test1/image/hello.htmlhas no exact match, it will match forwarding rule 2 based on longest prefix match; therefore, the request will be forwarded to the real servers associated with forwarding rule 2, i.e., port 81 of CVM2 and CVM3 in the figure.
example.qloud.com/test2/video/mp4/has no exact match, it will match forwarding rule 3 based on longest prefix match; therefore, the request will be forwarded to the real server associated with forwarding rule 3, i.e., port 90 of CVM4 in the figure.
example.qloud.com/test3/hello/index.htmlhas no exact match, it will match the root directory's default URL
example.qloud.com/by longest prefix match. In this case, Nginx will forward the request to the real server such as FastCGI (php) or Tomcat (jsp), while Nginx will exist as a reverse proxy server.
example.qloud.com/test2/has no exact match, it will match the root directory's default URL
example.qloud.com/by longest prefix match.
example.qloud.com/test1/image/index1.htmland matches it with forwarding rule 1. However, the real server of forwarding rule 1 has an exception and a 404 error page appears. You will see the 404 error page, but not being redirected to other pages.
/, but the access request from the client does not contain
/, then the request will be redirected to a rule ending with
HTTP:80listener, the configured domain name is
www.test.com/abc, it will be redirected to
www.test.com/abc/, it will match
www.test.com/abc, it will match
www.test.com/abc/, it will also match
A health check domain name is the domain name used by layer-7 CLB to detect the health status of a real server.
_. For example,
A health check path is the URL path used by layer-7 CLB to detect the health status of a real server.
/, with which the path must begin.
:. For example,