Updating a Forwarding Policy
Function
This API is used to update a forwarding policy.
Calling Method
For details, see Calling APIs.
URI
PUT /v3/{project_id}/elb/l7policies/{l7policy_id}
Parameter | Mandatory | Type | Description |
---|---|---|---|
l7policy_id | Yes | String | Specifies the forwarding policy ID. |
project_id | Yes | String | Specifies the project ID. |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | Specifies the token used for IAM authentication. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
l7policy | Yes | UpdateL7PolicyOption object | Specifies the forwarding policy. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
admin_state_up | No | Boolean | Specifies the administrative status of the forwarding policy. Note: The value can only be true. |
description | No | String | Provides supplementary information about the forwarding policy. |
name | No | String | Specifies the forwarding policy name. |
redirect_listener_id | No | String | Specifies the ID of the listener to which requests are redirected. Note:
|
redirect_pool_id | No | String | Specifies the ID of the backend server group that requests will be forwarded to. Note:
|
redirect_url_config | No | UpdateRedirectUrlConfig object | Specifies the URL to which requests are forwarded. Note:
Value format: protocol://host:port/path?query |
fixed_response_config | No | UpdateFixtedResponseConfig object | Specifies the configuration of the page that will be returned. Note:
|
redirect_pools_extend_config | No | Specifies the backend server group that the requests are forwarded to. | |
rules | No | Array of CreateRuleOption objects | Lists the forwarding rules in the forwarding policy. Note:
|
priority | No | Integer | Specifies the forwarding policy priority. A smaller value indicates a higher priority. Value ranges:
Default value options:
Note:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
protocol | No | String | Specifies the protocol for redirection. The value can be HTTP, HTTPS, or ${protocol}. The default value is ${protocol}, indicating that the protocol of the request will be used. |
host | No | String | Specifies the name of the host that requests are redirected to. The value can contain only letters, digits, hyphens (-), and periods (.) and must start with a letter or digit. The default value is ${host}, indicating that the host of the request will be used. |
port | No | String | Specifies the port that requests are redirected to. The default value is ${port}, indicating that the port of the request will be used. |
path | No | String | Specifies the path that requests are redirected to. The value can contain only letters, digits, and special characters: _~';@^-%#&$.*+?,=!:|\/()[]{} and must start with a slash (/). $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. The default value is ${path}, indicating that the path of the request will be used. |
query | No | String | Specifies the query string set in the URL for redirection. The value is case-sensitive and can contain only letters, digits, and special characters: !$&'()*+,-./:;=?@^_`. $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. The default value is ${query}, indicating that the query string of the request will be used. For example, in the URL https://www.example.com:8080/elb?type=loadbalancer, ${query} indicates type=loadbalancer. If this parameter is set to ${query}&name=my_name, the URL will be redirected to https://www.example.com:8080/elb?type=loadbalancer&name=my_name. |
status_code | No | String | Specifies the status code returned after the requests are redirected. The value can be 301, 302, 303, 307, or 308. |
insert_headers_config | No | UpdateInsertHeadersConfig object | Specifies the headers you want to write into the request that matches the forwarding rule. |
remove_headers_config | No | UpdateRemoveHeadersConfig object | Specifies the headers you want to remove from the request that matches the forwarding rule. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
status_code | No | String | Specifies the HTTP status code configured in the forwarding rule. The value can be any integer in the range of 200–299, 400–499, or 500–599. |
content_type | No | String | Specifies the format of the response body. The value can be text/plain, text/css, text/html, application/javascript, or application/json. |
message_body | No | String | Specifies the content of the response message body. |
insert_headers_config | No | UpdateInsertHeadersConfig object | Specifies the headers you want to write into the request that matches the forwarding rule. |
remove_headers_config | No | UpdateRemoveHeadersConfig object | Specifies the headers you want to remove from the request that matches the forwarding rule. |
traffic_limit_config | No | UpdateTrafficLimitConfig object | Specifies how requests are limited. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
configs | Yes | Array of UpdateInsertHeaderConfig objects | Specifies the headers you want to write into the request that matches the forwarding rule. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | Yes | String | Specifies the key of the header you want to write into the request that matches the forwarding rule. The value is a string of 1 to 40 case-insensitive characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. The key cannot be the following: 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, or x-nuwa-trace-ne-out. |
value_type | Yes | String | Specifies the value type of the header. The value can be USER_DEFINED, REFERENCE_HEADER, or SYSTEM_DEFINED. |
value | Yes | String | Specifies the value of the header. If value_type is set to SYSTEM_DEFINED, the value can be CLIENT-PORT, CLIENT-IP, ELB-PROTOCOL, ELB-ID, ELB-PORT, ELB-EIP, or ELB-VIP. The value can contain 1 to 128 characters. ASCII codes 32 through 127 printable characters, asterisk (*), and question mark (?) are also supported. The value cannot start or end with a space. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
configs | Yes | Array of UpdateRemoveHeaderConfig objects | Specifies the headers you want to remove from the request that matches the forwarding rule. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | Yes | String | Specifies the key of the header you want to remove from the request that matches the forwarding rule. The value is a string of 1 to 40 case-insensitive characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. The key cannot be the following: 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, or x-nuwa-trace-ne-out. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
qps | No | Integer | Specifies the maximum number of queries per second (QPS). The value ranges from 0 to 100000. 0 indicates that QPS is not limited. |
per_source_ip_qps | No | Integer | Specifies the maximum number of queries per second (QPS) from a source IP address. This parameter is not available for QUIC listeners. The value can be 0 or null. The value ranges from 0 to 100000. 0 indicates that QPS is not limited. If qps is not set to 0, per_source_ip_qps must be specified a smaller value than qps. |
burst | No | Integer | Specifies the maximum number of queries per second (QPS) from a source IP address. The value ranges from 0 to 100000. If the number of requests exceeds the value specified for qps but not reaches the value specified for burst, 503 status code will not be returned. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
rewrite_url_enable | No | Boolean | Specifies whether to enable URL redirection. |
rewrite_url_config | No | UpdateRewriteUrlConfig object | Specifies the URL that requests are directed to. This parameter takes effect only when action is set to REDIRECT_TO_POOL. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
host | No | String | Specifies the domain name of the host that requests are redirected to. The domain name can contain only letters, digits, hyphens (-), and periods (.), and must start with a letter or digit. The default value is ${host}, indicating that the host of the request will be used. |
path | No | String | Specifies the path that requests are redirected to. The value can contain only letters, digits, and special characters: _~';@^-%#&$.+?,=!:|/() and must start with a slash (/). $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. If the number of regular expression match groups is less than the specified number, ${path} is empty. If the dollar sign ($) is followed by a letter, the matching result is empty until the next special character appears, for example, $abc#123, and the matching result is #123. If the dollar sign ($) is followed by a special character, for example, $#, the matching result is $#. |
query | No | String | Specifies the query string set in the URL for redirection. The value is case-sensitive and can contain only letters, digits, and special characters: !$&'()+,-./:;=?@^_`. $1, $2, $3, and all the way to $9 match the wildcard asterisk () in the request URL. The default value is ${query}, indicating that the query string of the request will be used. If the number of regular expression match groups is less than the specified number, ${path} is empty. If the dollar sign ($) is followed by a letter, the matching result is empty until the next special character appears, for example, $abc#123, and the matching result is #123. If the dollar sign ($) is followed by a special character, for example, $#, the matching result is $#. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
admin_state_up | No | Boolean | Specifies the administrative status of the forwarding rule. The value can only be true. |
compare_type | Yes | String | Specifies how requests are matched with the forwarding rule. Value options:
Note:
|
key | No | String | Specifies the key of match content. For example, if the request header is used for forwarding, key is the request header. This parameter is unsupported. Please do not use it. |
value | Yes | String | Specifies the value of the match item. For example, if a domain name is used for matching, value is the domain name. Note:
|
project_id | No | String | Specifies the project ID. |
type | Yes | String | Specifies the type of the forwarding rule. Value options:
Note: If type is set to HOST_NAME, PATH, METHOD, or SOURCE_IP, only one forwarding rule can be created for each type. If type is set to HEADER and QUERY_STRING, multiple forwarding rules can be created for each type. |
invert | No | Boolean | Specifies whether reverse matching is supported. Value range: true or false Default value: false This parameter is unsupported. Please do not use it. |
conditions | No | Array of CreateRuleCondition objects | Specifies the conditions contained in a forwarding rule. Note:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | No | String | Specifies the key of match item. Note:
|
value | Yes | String | Specifies the value of the match item. Note:
Value ranges:
|
Response Parameters
Status code: 200
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID. The value is automatically generated. |
l7policy | L7Policy object | Specifies the forwarding policy. |
Parameter | Type | Description |
---|---|---|
action | String | Specifies where requests will be forwarded. Value options:
Note:
|
admin_state_up | Boolean | Specifies the administrative status of the forwarding policy. Note: The value can only be true. |
description | String | Provides supplementary information about the forwarding policy. |
id | String | Specifies the forwarding policy ID. |
listener_id | String | Specifies the ID of the listener to which the forwarding policy is added. |
name | String | Specifies the forwarding policy name. |
position | Integer | Specifies the forwarding policy priority. This parameter cannot be updated. This parameter is unsupported. Please do not use it. |
priority | Integer | Specifies the forwarding policy priority. A smaller value indicates a higher priority. Value ranges:
Default value options:
Note:
|
project_id | String | Specifies the project ID of the forwarding policy. |
provisioning_status | String | Specifies the provisioning status of the forwarding policy. The value can be ACTIVE or ERROR.
|
redirect_pool_id | String | Specifies the ID of the backend server group to which the requests are forwarded. Note:
|
redirect_listener_id | String | Specifies the ID of the listener to which requests are redirected. Note:
|
redirect_url | String | Specifies the URL to which requests are forwarded. Format: protocol://host:port/path?query This parameter is unsupported. Please do not use it. |
rules | Array of RuleRef objects | Lists the forwarding rules in the forwarding policy. |
redirect_url_config | RedirectUrlConfig object | Specifies the URL to which requests are forwarded. Note:
Value format: protocol://host:port/path?query |
redirect_pools_extend_config | RedirectPoolsExtendConfig object | Specifies the backend server group that requests are forwarded to. Note: This parameter takes effect only when action is set to REDIRECT_TO_POOL. |
fixed_response_config | FixtedResponseConfig object | Specifies the configuration of the page that will be returned. Note:
|
created_at | String | Specifies the time when the forwarding policy was added. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time). |
updated_at | String | Specifies the time when the forwarding policy was updated. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time). |
Parameter | Type | Description |
---|---|---|
id | String | Specifies the forwarding rule ID. |
Parameter | Type | Description |
---|---|---|
protocol | String | Specifies the protocol for redirection. The value can be HTTP, HTTPS, or ${protocol}. The default value is ${protocol}, indicating that the protocol of the request will be used. |
host | String | Specifies the name of the host that requests are redirected to. The value can contain only letters, digits, hyphens (-), and periods (.) and must start with a letter or digit. The default value is ${host}, indicating that the host of the request will be used. |
port | String | Specifies the port that requests are redirected to. The default value is ${port}, indicating that the port of the request will be used. |
path | String | Specifies the path that requests are redirected to. The value can contain only letters, digits, and special characters: _~';@^-%#&$.*+?,=!:|\/()[]{} and must start with a slash (/). $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. The default value is ${path}, indicating that the path of the request will be used. |
query | String | Specifies the query string set in the URL for redirection. The value is case-sensitive and can contain only letters, digits, and special characters: !$&'()*+,-./:;=?@^_`. $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. The default value is ${query}, indicating that the query string of the request will be used. For example, in the URL https://www.example.com:8080/elb?type=loadbalancer, ${query} indicates type=loadbalancer. If this parameter is set to ${query}&name=my_name, the URL will be redirected to https://www.example.com:8080/elb?type=loadbalancer&name=my_name. |
status_code | String | Specifies the status code returned after the requests are redirected. The value can be 301, 302, 303, 307, or 308. |
Parameter | Type | Description |
---|---|---|
rewrite_url_enable | Boolean | Specifies whether to enable URL redirection. |
rewrite_url_config | RewriteUrlConfig object | Specifies the URL for the backend server group that requests are forwarded to. This parameter is valid when rewrite_url_enable is set to true. |
Parameter | Type | Description |
---|---|---|
host | String | Specifies the domain name of the host that requests are redirected to. The domain name can contain only letters, digits, hyphens (-), and periods (.), and must start with a letter or digit. The default value is ${host}, indicating that the host of the request will be used. |
path | String | Specifies the path that requests are redirected to. The default value is ${path}, indicating that the path of the request will be used. The value can contain only letters, digits, and special characters: _~';@^-%#&$.+?,=!:|/() and must start with a slash (/). $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. If the number of regular expression match groups is less than the specified number, ${path} is empty. If the dollar sign ($) is followed by a letter, the matching result is empty until the next special character appears, for example, $abc#123, and the matching result is #123. If the dollar sign ($) is followed by a special character, for example, $#, the matching result is $#. |
query | String | Specifies the query string set in the URL for redirection. The value is case-sensitive and can contain only letters, digits, and special characters: !$&'()+,-./:;=?@^_`. $1, $2, $3, and all the way to $9 match the wildcard asterisk () in the request URL. The default value is ${query}, indicating that the query string of the request will be used. If the number of regular expression match groups is less than the specified number, ${path} is empty. If the dollar sign ($) is followed by a letter, the matching result is empty until the next special character appears, for example, $abc#123, and the matching result is #123. If the dollar sign ($) is followed by a special character, for example, $#, the matching result is $#. |
Parameter | Type | Description |
---|---|---|
status_code | String | Specifies the HTTP status code configured in the forwarding policy. The value can be any integer in the range of 200–299, 400–499, or 500–599. |
content_type | String | Specifies the format of the response body. The value can be text/plain, text/css, text/html, application/javascript, or application/json. |
message_body | String | Specifies the content of the response message body. |
Example Requests
Modifying a forwarding policy
PUT https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/l7policies/cf4360fd-8631-41ff-a6f5-b72c35da74be{"l7policy" : {"name" : "My policy.","description" : "Update policy.","redirect_listener_id" : "48a97732-449e-4aab-b561-828d29e45050"}}
Example Responses
Status code: 200
Successful request.
{"request_id" : "e5c07525-1470-47b6-9b0c-567527a036aa","l7policy" : {"redirect_pool_id" : "768e9e8c-e7cb-4fef-b24b-af9399dbb240","description" : "","admin_state_up" : true,"rules" : [ {"id" : "c5c2d625-676b-431e-a4c7-c59cc2664881"} ],"project_id" : "7a9941d34fc1497d8d0797429ecfd354","listener_id" : "cdb03a19-16b7-4e6b-bfec-047aeec74f56","redirect_url" : null,"redirect_url_config" : null,"redirect_pools_config" : {"pool_id" : "722e9e8c-e7cb-4fef-b24b-af9399dbb240","weight" : 12},"redirect_pools_sticky_session_config" : {"timeout" : 23,"enable" : false},"fixed_response_config" : null,"redirect_listener_id" : null,"action" : "REDIRECT_TO_POOL","position" : 100,"priority" : null,"provisioning_status" : "ACTIVE","id" : "01832d99-bbd8-4340-9d0c-6ff8f7a37307","name" : "l7policy-67"}}
Status Codes
Status Code | Description |
---|---|
200 | Successful request. |
Error Codes
See Error Codes.
- Calling Method
- URI