# Update the forwarding rule properties of the application load balancer - UpdateRuleAttribute

## Overview

Update the attributes of a forwarding rule for the application type load balancer listener






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `UpdateRuleAttribute`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.scloudsg.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [List of Regions and Availability Zones](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |**Yes**|
| **LoadBalancerId** | string | ID of the Load Balancing Instance |**Yes**|
| **ListenerId** | string | Listener's ID |**Yes**|
| **RuleId** | string | ID of the forwarding rule |**Yes**|
| **RuleConditions.N.Type** | string | Matching condition type. Limited enumeration values: "Host"/"Path"; Must be filled in when the length of the RuleConditions array is not 0. |No|
| **RuleConditions.N.HostConfig.MatchMode** | string | Matching method. Limited enumeration values: 'Regular'/'Wildcard', default value: 'Regular'. |No|
| **RuleConditions.N.HostConfig.Values.N** | string | Value. Currently only supports an array length of 1; the value must comply with the conditions of the relevant matching method; it is required when modifying the domain name match. |No|
| **RuleConditions.N.PathConfig.Values.N** | string | Value. Temporarily only supports an array length of 1; the value must meet the relevant conditions; it is required when modifying the path match. |No|
| **RuleActions.N.Type** | string | Action Type. Limited enumeration value: "Forward"; Must be filled in when the length of the RuleActions array is not 0. |No|
| **RuleActions.N.ForwardConfig.Targets.N.Id** | string | The identifier ID of the backend service node being forwarded. It is limited to the service node pool of the listener; the array length can be 0; when the array length of the configured forwarding service node is not 0, the ID is required. |No|
| **RuleActions.N.ForwardConfig.Targets.N.Weight** | int | The weight of the backend service node being forwarded. Only valid when the load balancing algorithm of the listener is weighted round robin. |No|
| **RuleActions.N.Order** | int | The execution order of forwarding rule actions ranges from 1 to 1000, and actions are executed in ascending order. The value cannot be empty or duplicated.<br /><br />Forward and FixedResponse types of actions do not consider Order and are executed last. |No|
| **RuleActions.N.InsertHeaderConfig.Key** | string | The inserted header field name must be between 1 to 40 characters in length and can include uppercase and lowercase letters a-z, numbers, underscores (_), and hyphens (-). The header field name cannot be used repeatedly in InsertHeader.<br /><br />The header field cannot use the following (case-insensitive):<br /><br />x-real-ip, x-forwarded-for, x-forwarded-proto, x-forwarded-srcport, ucloud-alb-trace, connection, upgrade, content-length, transfer-encoding, keep-alive, te, host, cookie, remoteip, authority. |No|
| **RuleActions.N.InsertHeaderConfig.ValueType** | string | Header field content type. Values:<br />UserDefined: User specified.<br /><br />ReferenceHeader: Reference a field from the user's request header.<br /><br />SystemDefined: System defined. |No|
| **RuleActions.N.InsertHeaderConfig.Value** | string | Inserted header field content.<br /><br />When ValueType is SystemDefined, the values are as follows:<br />ClientSrcPort: Client port.<br />ClientSrcIp: Client IP address.<br />Protocol: Protocol of the client's request (HTTP or HTTPS).<br />RuleID: Forwarding rule ID hit by the client's request.<br />ALBID: ALB ID.<br />ALBPort: ALB port.<br /><br />When ValueType is UserDefined:<br /><br />You can customize the header field content, with a length limit of 1\~128 characters, only supporting printable characters within the ASCII code range ch >= 32 && ch < 127, excluding $.<br /><br />When ValueType is ReferenceHeader:<br /><br />You can reference a specific field in the request header field, with a length limit of 1\~128 characters, supporting lowercase letters a\~z, numbers, hyphens (-), and underscores (_). |No|
| **RuleActions.N.RemoveHeaderConfig.Key** | string | Names of header fields to be deleted. Currently, only the following default configured fields can be deleted:<br /><br />X-Real-IP, X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-SrcPort |No|
| **RuleActions.N.CorsConfig.AllowOrigin.N** | string | Allowed access source list. Supports configuring only one element *, or configuring one or more values.<br /><br />A single value must start with http:// or https://, followed by a correct domain name or a primary wildcard domain. (Example: http://*.test.abc.example.com)<br />A single value can be without a port or specify a port, with a port range: 1\~65535.<br />Supports up to 5 values. |No|
| **RuleActions.N.CorsConfig.AllowHeaders.N** | string | List of Headers allowed for cross-origin. Supports configuration as * or one or more value entries. A single value entry can only contain uppercase and lowercase letters, numbers, and cannot start or end with an underscore (_) or hyphen (-), with a maximum length of 32 characters. Supports up to 20 values. |No|
| **RuleActions.N.CorsConfig.ExposeHeaders.N** | string | List of allowed exposed Headers. Supports configuration as * or one or more value(s). A single value can only contain uppercase and lowercase letters, numbers, and cannot begin or end with an underscore (_) or hyphen (-), with a maximum length of 32 characters. Supports up to 20 values. |No|
| **RuleActions.N.CorsConfig.AllowMethods.N** | string | Select the allowed HTTP methods for cross-domain access. Values:<br /><br />GET.<br />POST.<br />PUT.<br />DELETE.<br />HEAD.<br />OPTIONS.<br />PATCH. |No|
| **RuleActions.N.CorsConfig.AllowCredentials** | string | Whether to allow carrying credential information. Values:<br /><br />on: Yes.<br />off: No. |No|
| **RuleActions.N.CorsConfig.MaxAge** | int | The maximum cache time for preflight requests in the browser, in seconds.<br /><br />Value range: -1\~172800. |No|
| **RuleActions.N.FixedResponseConfig.HttpCode** | int | Returned HTTP response codes, only support 2xx, 4xx, 5xx numbers, where x is any digit. |No|
| **RuleActions.N.FixedResponseConfig.Content** | string | Returned fixed content. Supports storage up to 1 KB, only supports printable characters within the ASCII code range ch >= 32 && ch < 127, excluding $. |No|
| **Pass** | boolean | Whether the rule is ignored when the service node to be forwarded is empty. The default forwarding rule cannot be changed. |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|




## Example

### Request Example
    
```
https://api.scloudsg.com/?Action=UpdateRuleAttribute
&Region=cn-zj
&ProjectId=fMqGeCGY
&LoadBalancerId=PEmbuMhD
&ListenerId=eudxefBy
&RuleId=uOPZrous
&RuleConditions.n.Type=XPnIhJcD
&RuleConditions.n.HostConfig.MatchMode=pcWuiASR
&RuleConditions.n.HostConfig.Values.n=NbTJIuXo
&RuleConditions.n.PathConfig.Values.n=vXMMFKpU
&RuleActions.n.Type=sCUpJcAT
&RuleActions.n.ForwardConfig.Targets.n.Id=ejIILinH
&RuleActions.n.ForwardConfig.Targets.n.Weight=6
&Pass=true
&RuleActions.n.Order=1
&RuleActions.n.InsertHeaderConfig.Key=iGHrRJXh
&RuleActions.n.InsertHeaderConfig.ValueType=WcdWrLgO
&RuleActions.n.InsertHeaderConfig.Value=UNEDnrWk
&RuleActions.n.RemoveHeaderConfig.Key=CiMITCzA
&RuleActions.n.CorsConfig.AllowOrigin.n=PPXPigPd
&RuleActions.n.CorsConfig.AllowHeaders.n=nkbiBXLo
&RuleActions.n.CorsConfig.ExposeHeaders.n=tpamsjOJ
&RuleActions.n.CorsConfig.AllowMethods.n=mOlPiQPi
&RuleActions.n.CorsConfig.AllowCredentials=oPdIQEiP
&RuleActions.n.CorsConfig.MaxAge=6
&RuleActions.n.FixedResponseConfig.HttpCode=5
&RuleActions.n.FixedResponseConfig.Content=hzFSdYOm
```

### Response Example
    
```json
{
  "Action": "UpdateRuleAttributeResponse",
  "RetCode": 0
}
```





