Each HTTP or HTTPS listener has a default forwarding policy. You can also define additional forwarding policies. Each forwarding policy consists of a priority, one or more forwarding rules, and an action.
After you add an HTTP or HTTPS listener to a load balancer, a default forwarding policy is generated. This policy uses the protocol and port specified for the listener to match requests and forward the requests to the backend server group specified when you add the listener.
The default forwarding policy has the lowest priority and is not included when you sort forwarding policies. It can be edited but cannot be deleted.
If you have enabled advanced forwarding, you can choose to disassociate the backend server group from the default forwarding policy.
Route requests based on the domain name. Exact match domains and wildcard domains are supported.
Request URL: https://www.example.com/login.php?locale=en-us=#videos Domain name in the forwarding rule: www.example.com
Request URL: https://www.example.com/login.php?locale=en-us#videos URL in the forwarding rule: /login.php
If the URL contains special characters such as question marks (?) or pound keys (#), escape the special characters before configuring the forwarding rule.
Route requests based on the query string.
Request URL: https://www.example.com/login.php?locale=en-us#videos Two query strings need to be configured for the forwarding rule: Key: locale Value: en-us
Route requests based on any HTTP method.
GET
Route requests based on any HTTP header.
Key: Accept-Language Value: en-us
Route requests based on source IP addresses from where the requests originate.
Both IPv4 and IPv6 addresses are supported.
Example
192.168.1.0/24 or 2020:50::44/127
There are four types of actions: forward to a backend server group, redirect to another listener, redirect to another URL, and return a specific response body.
Requests are forwarded to the specified backend server group.
Requests are redirected to the specified listener, which then routes the requests to its associated backend server group.
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.
Requests are redirected to the configured URL.
When clients access website A, the load balancer returns 302 or any other 3xx status code and automatically redirects the clients to website B. You can custom the redirection URL that will be returned to the clients.
${host}: retains the domain name of the request.
Specify either the above parameters or a combination of them.
URL for redirection: http://www.example1.com/index.html?locale=en-us#videos Protocol: HTTP Domain name: www.example1.com Port: 8081 Path: /index.html Query string: locale=en-us HTTP status code: 301
Load balancers return a fixed response to the clients.
You can custom the status code and response body that load balancers directly return to the clients without the need to route the requests to backend servers.
Sorry, the language is not supported.
text/css
<head><style type="text/css">div {background-color:red}#div {font-size:15px;color:red}</style></head>
text/html
<form action="/" method="post" enctype="multipart/form-data"><input type="text" name="description" value="some text"><input type="file" name="myFile"><button type="submit">Submit</button></form>
application/javascript
String.prototype.trim = function() {var reExtraSpace = /^\s*(.*?)\s+$/;return this.replace(reExtraSpace, "$1")}
application/json
{ "publicip": { "type": "5_bgp","ip_version": 4},"bandwidth": {"name": "bandwidth123","size": 10,"share_type": "PER"}}
Ensure that the response body does not contain carriage return characters. Otherwise, it cannot be saved.