Skip to Content
Load Balance(ULB) UpdateRuleAttribute

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 NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is UpdateRuleAttribute.Yes
PublicKeystringThe user’s public key can be obtained from ConsoleYes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
RegionstringRegion. See List of Regions and Availability ZonesYes
ProjectIdstringProject ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface.Yes
LoadBalancerIdstringID of the Load Balancing InstanceYes
ListenerIdstringListener’s IDYes
RuleIdstringID of the forwarding ruleYes
RuleConditions.N.TypestringMatching 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.MatchModestringMatching method. Limited enumeration values: ‘Regular’/‘Wildcard’, default value: ‘Regular’.No
Values.NstringValue. 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
Values.NstringValue. 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.TypestringAction Type. Limited enumeration value: “Forward”; Must be filled in when the length of the RuleActions array is not 0.No
Targets.N.IdstringThe 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
Targets.N.WeightintThe 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.OrderintThe 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.

Forward and FixedResponse types of actions do not consider Order and are executed last.
No
RuleActions.N.InsertHeaderConfig.KeystringThe 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.

The header field cannot use the following (case-insensitive):

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.ValueTypestringHeader field content type. Values:
UserDefined: User specified.

ReferenceHeader: Reference a field from the user’s request header.

SystemDefined: System defined.
No
RuleActions.N.InsertHeaderConfig.ValuestringInserted header field content.

When ValueType is SystemDefined, the values are as follows:
ClientSrcPort: Client port.
ClientSrcIp: Client IP address.
Protocol: Protocol of the client’s request (HTTP or HTTPS).
RuleID: Forwarding rule ID hit by the client’s request.
ALBID: ALB ID.
ALBPort: ALB port.

When ValueType is UserDefined:

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 $.

When ValueType is ReferenceHeader:

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.KeystringNames of header fields to be deleted. Currently, only the following default configured fields can be deleted:

X-Real-IP, X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-SrcPort
No
AllowOrigin.NstringAllowed access source list. Supports configuring only one element , or configuring one or more values.

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)
A single value can be without a port or specify a port, with a port range: 1~65535.
Supports up to 5 values.
No
AllowHeaders.NstringList 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
ExposeHeaders.NstringList 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
AllowMethods.NstringSelect the allowed HTTP methods for cross-domain access. Values:

GET.
POST.
PUT.
DELETE.
HEAD.
OPTIONS.
PATCH.
No
RuleActions.N.CorsConfig.AllowCredentialsstringWhether to allow carrying credential information. Values:

on: Yes.
off: No.
No
RuleActions.N.CorsConfig.MaxAgeintThe maximum cache time for preflight requests in the browser, in seconds.

Value range: -1~172800.
No
RuleActions.N.FixedResponseConfig.HttpCodeintReturned HTTP response codes, only support 2xx, 4xx, 5xx numbers, where x is any digit.No
RuleActions.N.FixedResponseConfig.ContentstringReturned fixed content. Supports storage up to 1 KB, only supports printable characters within the ASCII code range ch >= 32 && ch < 127, excluding $.No
PassbooleanWhether the rule is ignored when the service node to be forwarded is empty. The default forwarding rule cannot be changed.No

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No

Example

Request Example

https://api.genesissai.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

{ "Action": "UpdateRuleAttributeResponse", "RetCode": 0 }