Action
Introduction
You can add advanced forwarding policies to HTTP or HTTPS listeners to forward requests to different backend server groups based on a wide range of forwarding rules and actions.
Action Types
Advanced forwarding policies support the following actions: forward to a backend server group, redirect to another listener, redirect to another URL, and return a specific response body.
The following additional actions are supported:
- Forward to backend server group: rewrite, write header, remove header, and limit request
- Return a specific response body: limit request.
Action |
Description |
---|---|
Forward to a backend server group |
Requests are forwarded to the specified backend server group.
NOTE:
If Action is set to Forward to a backend server group, you can also select from one of the following actions: Rewrite, Write header, Remove header, and Limit request. For details, see Table 2. |
Redirect to another listener |
Requests are redirected to another listener, which then routes the requests to its associated backend server group.
NOTE:
If you select Redirect to another listener, the configurations for the HTTP listener will not be applied, but access control configured for the listener will still be applied. 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. |
Redirect to another URL |
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 customize the redirection URL that will be returned to the clients.
Configure at least one of the following components:
Example 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 |
Rewrite |
Rewrites the request URL before forwarding requests to the specified backend server group.
Configure the following parameters:
NOTE:
The domain name, path, and query string cannot be left blank or made default. |
Return a specific response body |
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.
Configure the following parameters:
Example text/plain 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"}}
NOTE:
Ensure that the response body does not contain carriage return characters. Otherwise, it cannot be saved. |
Action |
Description |
---|---|
Rewrite |
Rewrites the request URL before forwarding requests to the specified backend server group.
Configure the following parameters:
NOTE:
The domain name, path, and query string cannot be left blank or made default. |
Write header |
Writes the configured header into the request before forwarding it to the specified backend server group. You can specify the key and value of the header you want to write into the request that matches the forwarding rule. The headers you have configured will overwrite the existing headers. By default, you can configure five headers.
A header consists of a key and one or more values. You need to configure the key and values separately.
For details about how to write a header, see Table 3. |
Remove header |
Removes the configured headers from the request before forwarding it to the specified backend server group. You can specify the value of the header you want to remove from the request that matches the forwarding rule. The headers match the ones you have configured will be removed from the requests. By default, you can configure five headers. The key can contain only letters, digits, underscores (_), and hyphens (-). |
Request Header |
Header Key |
Header Value |
Written Request Header |
|
---|---|---|---|---|
header1:aaa header2:bbb |
header3 |
Manually-defined value |
ccc |
header1:aaa header2:bbb header3:ccc |
header3 |
System-defined value |
Client port |
header1:aaa header2:bbb header3: Client port |
|
header3 |
Reference value |
header1 |
header1:aaa header2:bbb header3:aaa |

The value of the following headers cannot be modified:
connection, upgrade, content-length, transfer-encoding, keep-alive, te, host, cookie, remoteip, authority, x-forwarded-host, x-forwarded-for, x-forwarded-for-port, x-forwarded-tls-certificate-id, x-forwarded-tls-protocol, x-forwarded-tls-cipher, x-forwarded-elb-ip, x-forwarded-port, x-forwarded-elb-id, x-forwarded-elb-vip, x-real-ip, x-forwarded-proto, x-nuwa-trace-ne-in, and x-nuwa-trace-ne-out.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot