Modifies forwarding rules.
Description
- UpdateForwardingRules is an asynchronous operation. After you send a request, the system returns a request
ID, but the operation is still being performed in the system background. You can call
the ListForwardingRules operation to query the state of a forwarding rule.
- If the forwarding rule is in the configuring state, it indicates that the forwarding rule is being modified. In this case, you can perform only query operations.
- If the forwarding rule is in the active state, it indicates that the forwarding rule is modified.
- The UpdateForwardingRules operation cannot be repeatedly called to modify forwarding rules for the same Global Accelerator (GA) instance within a specific period of time.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | UpdateForwardingRules |
The operation that you want to perform. Set the value to UpdateForwardingRules. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region where the GA instance is deployed. Set the value to cn-hangzhou. |
ClientToken | String | No | 02fb3da4**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among all requests. ClientToken can contain only ASCII characters. Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each API request.
|
AcceleratorId | String | Yes | ga-bp17frjjh0udz4q**** |
The ID of the GA instance. |
ListenerId | String | Yes | lsr-bp1s0vzbi5bxlx5**** |
The ID of the listener. |
ForwardingRules.N.Priority | Integer | Yes | 1000 |
The priority of the forwarding rule. Valid values: 1 to 10000. A lower value indicates a higher priority. |
ForwardingRules.N.RuleConditions.N.RuleConditionType | String | Yes | Host |
The type of the forwarding conditions. Valid values:
|
ForwardingRules.N.RuleConditions.N.RuleConditionValue | String | No | ["www.example.com", "www.aliyun.com"] |
The value of the forwarding condition type. You must specify different JSON strings based on the RuleConditionType parameter.
|
ForwardingRules.N.RuleConditions.N.PathConfig | Map | No |
The configuration of the path. Note We recommend that you do not use this parameter. We recommend that you use the RuleConditionType and RuleConditionValue parameters to configure forwarding conditions.
|
|
ForwardingRules.N.RuleConditions.N.HostConfig | Map | No |
The configuration of the domain name. Note We recommend that you do not use this parameter. We recommend that you use the RuleConditionType and RuleConditionValue parameters to configure forwarding conditions.
|
|
ForwardingRules.N.RuleActions.N.Order | Integer | Yes | 20 |
The forwarding priority. Note This parameter does not take effect. Ignore this parameter.
|
ForwardingRules.N.RuleActions.N.RuleActionType | String | Yes | ForwardGroup |
The type of the forwarding action. Valid values:
|
ForwardingRules.N.RuleActions.N.RuleActionValue | String | No | [{"type":"endpointgroup", "value":"epg-bp1enpdcrqhl78g6r****"}] |
The value of the forwarding action type. You must specify different JSON strings based on the RuleActionType parameter. A forwarding rule can contain only one forwarding action whose type is ForwardGroup, Redirect, or FixResponse. You must specify a forwarding action whose type is Rewrite, AddHeader, or RemoveHeader before a forwarding action whose type is ForwardGroup.
|
ForwardingRules.N.RuleActions.N.ForwardGroupConfig | Map | No |
The forwarding configurations. Note We recommend that you do not use this parameter. We recommend that you use the RuleActionType and RuleActionValue parameters to configure forwarding actions.
|
|
ForwardingRules.N.ForwardingRuleId | String | Yes | frule-bp1dii16gu9qdvb34**** |
The ID of the forwarding rule. |
ForwardingRules.N.ForwardingRuleName | String | No | test |
The name of the forwarding rule. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter. |
ForwardingRules.N.RuleDirection | String | No | request |
The direction in which the rule takes effect. You do not need to set this parameter. By default, this parameter is set to request, which indicates that the rule takes effect on requests. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
ForwardingRules | Array of ForwardingRules |
Details about the forwarding rules. |
|
ForwardingRuleId | String | frule-bp1dii16gu9qdvb34**** |
The ID of the forwarding rule. |
RequestId | String | 64ADAB1E-0B7F-4FD8-A404-3BECC0E9CCFF |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=UpdateForwardingRules
&RegionId=cn-hangzhou
&ClientToken=02fb3da4****
&AcceleratorId=ga-bp17frjjh0udz4q****
&ListenerId=lsr-bp1s0vzbi5bxlx5****
&ForwardingRules=[{"Priority":1000,"RuleConditions":[{"RuleConditionType":"Host","RuleConditionValue":"[\"www.example.com\", \"www.aliyun.com\"]"}],"RuleActions":[{"Order":20,"RuleActionType":"ForwardGroup","RuleActionValue":"[{\"type\":\"endpointgroup\", \"value\":\"epg-bp1enpdcrqhl78g6r****\"}]"}],"ForwardingRuleId":"frule-bp1dii16gu9qdvb34****","ForwardingRuleName":"test","RuleDirection":"request"}]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<UpdateForwardingRulesResponse>
<ForwardingRules>
<ForwardingRuleId>frule-bp1dii16gu9qdvb34****</ForwardingRuleId>
</ForwardingRules>
<RequestId>64ADAB1E-0B7F-4FD8-A404-3BECC0E9CCFF</RequestId>
</UpdateForwardingRulesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"ForwardingRules" : [ {
"ForwardingRuleId" : "frule-bp1dii16gu9qdvb34****"
} ],
"RequestId" : "64ADAB1E-0B7F-4FD8-A404-3BECC0E9CCFF"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | NotExist.Listener | The listener does not exist. | The error message returned because the specified listener does not exist. |
400 | NotActive.Listener | The state of the listener is not active. | The error message returned because the specified listener is unstable. |
400 | NotExist.Accelerator | The accelerated instance does not exist. | The error message returned because the specified GA instance does not exist. |
400 | NotExist.BusinessRegion | The business region does not exist. | The error message returned because the specified region does not exist. |
400 | NotExist.BasicBandwidthPackage | You must specify the basic bandwidth package. | The error message returned because no basic bandwidth plan is specified. |
400 | QuotaExceeded.EndPoint | The maximum number of endpoints is exceeded. | The error message returned because the number of endpoints has reached the upper limit. |
400 | Exist.EndpointGroup | The endpoint group already exists. | The error message returned because the specified endpoint group already exists. |
400 | NoPermission.VpcEndpoint | You are not authorized to perform the operation. | The error message returned because you are not authorized to create the service-linked role. Contact the owner of the Alibaba Cloud account or the administrator to attach the AliyunGlobalAccelerationFullAccess policy or a custom permission policy that grants the permissions to create the required service-linked role to your RAM user. In the custom policy, the service name must be set to vpcendpoint.ga.aliyuncs.com, the service-linked role to AliyunServiceRoleForGaVpcEndpoint, and the permissions to ram:CreateServiceLinkedRole. |
For a list of error codes, visit the API Error Center.