ALIYUN::ALB::Rule creates a forwarding rule for an Application Load Balancer (ALB) listener.
Syntax
{
"Type": "ALIYUN::ALB::Rule",
"Properties": {
"RuleActions": List,
"Priority": Integer,
"RuleConditions": List,
"Direction": String,
"RuleName": String,
"ListenerId": String
}
}
Properties
|
Property |
Type |
Required |
Allow updates |
Description |
Constraints |
|
ListenerId |
String |
Yes |
No |
The ID of the listener for the Application Load Balancer (ALB) instance. |
None |
|
Priority |
Integer |
Yes |
Yes |
The priority of the forwarding rule. |
Valid values: 1 to 10,000. A smaller value indicates a higher priority. Note
The priority of each forwarding rule within the same listener must be unique. |
|
RuleActions |
List |
Yes |
Yes |
The actions of the forwarding rule. |
For more information, see RuleActions properties. |
|
RuleConditions |
List |
Yes |
Yes |
The conditions of the forwarding rule. |
For more information, see RuleConditions properties. |
|
RuleName |
String |
Yes |
Yes |
The name of the forwarding rule. |
The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character and can contain letters, Chinese characters, digits, periods (.), underscores (_), and hyphens (-). |
|
Direction |
String |
No |
No |
The direction of the forwarding rule. |
Valid values:
|
RuleActions syntax
"RuleActions": [
{
"Order": Integer,
"FixedResponseConfig": Map,
"Type": String,
"RedirectConfig": Map,
"ForwardGroupConfig": Map,
"InsertHeaderConfig": Map,
"RewriteConfig": Map,
"TrafficMirrorConfig": Map,
"TrafficLimitConfig": Map,
"RemoveHeaderConfig": Map,
"CorsConfig": Map
}
]
RuleActions properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Order |
Integer |
Yes |
Yes |
The order in which the forwarding rule actions are performed. |
Valid values: 1 to 50,000. Actions are performed in ascending order of value. Note
The value must be unique. |
|
Type |
String |
Yes |
Yes |
The action type. |
Valid values:
|
|
CorsConfig |
Map |
No |
Yes |
The cross-domain configuration. |
For more information, see CorsConfig properties. |
|
FixedResponseConfig |
Map |
No |
Yes |
The fixed response configuration. |
For more information, see FixedResponseConfig properties. |
|
ForwardGroupConfig |
Map |
No |
Yes |
The forwarding group configuration. |
For more information, see ForwardGroupConfig properties. |
|
InsertHeaderConfig |
Map |
No |
Yes |
The configuration for inserting a header field. |
For more information, see InsertHeaderConfig properties. |
|
RedirectConfig |
Map |
No |
Yes |
The redirection configuration. |
For more information, see RedirectConfig properties. |
|
RemoveHeaderConfig |
Map |
No |
Yes |
The configuration for deleting a header field. |
For more information, see RemoveHeaderConfig properties. |
|
RewriteConfig |
Map |
No |
Yes |
The rewrite configuration. |
For more information, see RewriteConfig properties. |
|
TrafficLimitConfig |
Map |
No |
Yes |
The traffic throttling configuration. |
For more information, see TrafficLimitConfig properties. |
|
TrafficMirrorConfig |
Map |
No |
Yes |
The traffic mirroring configuration. |
For more information, see TrafficMirrorConfig properties. |
FixedResponseConfig syntax
"FixedResponseConfig": {
"HttpCode": String,
"ContentType": String,
"Content": String
}
FixedResponseConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Content |
String |
No |
Yes |
The content of the fixed response. |
The content can be up to 1 KB in size and must consist of ASCII characters. |
|
ContentType |
String |
No |
Yes |
The format of the fixed response. |
Valid values:
|
|
HttpCode |
String |
No |
Yes |
The HTTP response code. |
Valid values are strings in the format of HTTP_2xx, HTTP_4xx, and HTTP_5xx, where x is any digit. |
RedirectConfig syntax
"RedirectConfig": {
"Path": String,
"HttpCode": Integer,
"Query": String,
"Port": String,
"Host": String,
"Protocol": String
}
RedirectConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Host |
String |
No |
Yes |
The host to which requests are redirected. |
Valid values:
|
|
HttpCode |
Integer |
No |
Yes |
The redirection method. |
Valid values:
|
|
Path |
String |
No |
Yes |
The path to which requests are redirected. |
Valid values:
|
|
Port |
String |
No |
Yes |
The port to which requests are redirected. |
Valid values:
|
|
Protocol |
String |
No |
Yes |
The protocol to which requests are redirected. |
Valid values:
|
|
Query |
String |
No |
Yes |
The query string to which requests are redirected. |
Valid values:
|
ForwardGroupConfig syntax
"ForwardGroupConfig": {
"ServerGroupTuples": List,
"ServerGroupStickySession": Map
}
ForwardGroupConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
ServerGroupStickySession |
Map |
No |
Yes |
The session persistence configuration. |
For more information, see ServerGroupStickySession properties. |
|
ServerGroupTuples |
List |
No |
Yes |
The list of destination vServer groups. |
For more information, see ServerGroupTuples properties. |
ServerGroupStickySession syntax
"ServerGroupStickySession": {
"Enabled": Boolean,
"Timeout": Integer
}ServerGroupStickySession properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Enabled |
Boolean |
No |
Yes |
Specifies whether to enable session persistence. |
Valid values:
|
|
Timeout |
Integer |
No |
Yes |
The timeout period. |
Unit: seconds. Valid values: 1 to 86400. |
ServerGroupTuples syntax
"ServerGroupTuples": [
{
"ServerGroupId": String
}
]
ServerGroupTuples properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
ServerGroupId |
String |
Yes |
Yes |
The ID of the destination vServer group. |
None |
InsertHeaderConfig syntax
"InsertHeaderConfig": {
"ValueType": String,
"Value": String,
"Key": String
}
InsertHeaderConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Key |
String |
No |
Yes |
The name of the header field to insert. |
The name must be 1 to 40 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The header name in InsertHeaderConfig must be unique. Note
The header name cannot be set to any of the following values (case-insensitive): slb-id, slb-ip, x-forwarded-for, x-forwarded-proto, x-forwarded-eip, x-forwarded-port, x-forwarded-client-srcport, connection, upgrade, content-length, transfer-encoding, keep-alive, te, host, cookie, remoteip, authority. |
|
Value |
String |
No |
Yes |
The content of the header field to insert. |
Valid values:
|
|
ValueType |
String |
No |
Yes |
The type of the header field content. |
Valid values:
|
RewriteConfig syntax
"RewriteConfig": {
"Path": String,
"Query": String,
"Host": String
}
RewriteConfig properties
|
Property |
Type |
Required |
Allow Updates |
Description |
Constraints |
|
Host |
String |
No |
Yes |
The destination host for the internal rewrite. |
Valid values:
|
|
Path |
String |
No |
Yes |
The path to rewrite. |
Valid values:
|
|
Query |
String |
No |
Yes |
The query string for the internal rewrite. |
Valid values:
|
RuleConditions syntax
"RuleConditions": [
{
"MethodConfig": Map,
"PathConfig": Map,
"Type": String,
"QueryStringConfig": Map,
"HostConfig": Map,
"CookieConfig": Map,
"HeaderConfig": Map,
"SourceIpConfig": Map,
"ResponseStatusCodeConfig": Map,
"ResponseHeaderConfig": Map
}
]
RuleConditions properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Type |
String |
Yes |
Yes |
The type of the forwarding rule condition. |
Valid values:
|
|
CookieConfig |
Map |
No |
Yes |
The cookie configuration. |
For more information, see CookieConfig properties. |
|
HeaderConfig |
Map |
No |
Yes |
The header field configuration. |
For more information, see HeaderConfig properties. |
|
HostConfig |
Map |
No |
Yes |
The host configuration. |
For more information, see HostConfig properties. |
|
MethodConfig |
Map |
No |
Yes |
The request method configuration. |
For more information, see MethodConfig properties. |
|
PathConfig |
Map |
No |
Yes |
The forwarding path configuration. |
For more information, see PathConfig properties. |
|
QueryStringConfig |
Map |
No |
Yes |
The query string configuration. |
For more information, see QueryStringConfig properties. |
|
SourceIpConfig |
Map |
No |
Yes |
Configuring forwarding rules. |
For more information, see SourceIpConfig properties. |
|
ResponseStatusCodeConfig |
Map |
No |
Yes |
The response status code configuration. |
For more information, see ResponseStatusCodeConfig properties. |
|
ResponseHeaderConfig |
Map |
No |
Yes |
The response header condition configuration. |
For more information, see ResponseHeaderConfig properties. |
ResponseStatusCodeConfig syntax
"ResponseStatusCodeConfig": {
"Values": List
}ResponseStatusCodeConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Values |
List |
No |
Yes |
The list of response status codes. |
None. |
ResponseHeaderConfig syntax
"ResponseHeaderConfig": {
"Key": String,
"Values": List
}ResponseHeaderConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Key |
String |
No |
Yes |
The key of the header field. |
|
|
Values |
List |
No |
Yes |
The value of the header field. |
|
SourceIpConfig syntax
"SourceIpConfig": {
"Values": List
}SourceIpConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Values |
List |
No |
Yes |
One or more IP addresses or CIDR blocks. |
A forwarding rule can contain up to five IP addresses. |
MethodConfig syntax
"MethodConfig": {
"Values": List
}
MethodConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Values |
List |
No |
Yes |
The request method. |
Valid values:
|
PathConfig syntax
"PathConfig": {
"Values": List
}
PathConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Values |
List |
No |
Yes |
The forwarding path. |
The path must be 1 to 128 characters in length. It must start with a forward slash (/) and can contain letters, digits, the asterisk (*), the question mark (?), and the following special characters: |
QueryStringConfig syntax
"QueryStringConfig": {
"Values": List
}
QueryStringConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Values |
List |
No |
Yes |
The query string. |
None |
HostConfig syntax
"HostConfig": {
"Values": List
}
HostConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Values |
List |
No |
Yes |
The hostname. |
The value must meet the following requirements:
|
CookieConfig syntax
"CookieConfig": {
"Values": List
}
CookieConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Values |
List |
No |
Yes |
The list of cookie values. |
None |
HeaderConfig syntax
"HeaderConfig": {
"Values": List,
"Key": String
}
HeaderConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Key |
String |
No |
Yes |
The key of the header field. |
The key must be 1 to 40 characters in length. It can contain lowercase letters, digits, hyphens (-), and underscores (_). Cookie and Host are not supported. |
|
Values |
List |
No |
Yes |
The value of the header field. |
The header field value must be unique within the same forwarding rule condition. The value must be 1 to 128 characters in length and can contain printable characters with ASCII values from |
TrafficMirrorConfig syntax
"TrafficMirrorConfig": {
"MirrorGroupConfig": Map,
"TargetType": String
}TrafficMirrorConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
MirrorGroupConfig |
Map |
No |
Yes |
The vServer group configuration. |
For more information, see MirrorGroupConfig properties. |
|
TargetType |
String |
No |
Yes |
The type of the mirroring destination. |
Valid values:
|
MirrorGroupConfig syntax
"MirrorGroupConfig": {
"ServerGroupTuples": List
}MirrorGroupConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
ServerGroupTuples |
List |
Yes |
Yes |
The list of vServer groups. |
None |
TrafficLimitConfig syntax
"TrafficLimitConfig": {
"PerIpQps": Integer,
"QPS": Integer
}TrafficLimitConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
PerIpQps |
Integer |
No |
Yes |
The number of queries per second (QPS) for a single IP address. |
Valid values: 1 to 100000. |
|
QPS |
Integer |
No |
Yes |
The total number of queries per second (QPS). |
Valid values: 1 to 100000. Note
If you configure both QPS and PerIpQps, the value of PerIpQps must be smaller than the value of QPS. |
RemoveHeaderConfig syntax
"RemoveHeaderConfig": {
"Key": String
}RemoveHeaderConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
Key |
String |
No |
Yes |
The key of the header field. |
None |
CorsConfig syntax
"CorsConfig": {
"AllowMethods": List,
"AllowHeaders": List,
"AllowOrigin": List,
"MaxAge": Integer,
"AllowCredentials": String,
"ExposeHeaders": List
}CorsConfig properties
|
Property |
Type |
Required |
Updatable |
Description |
Constraints |
|
AllowMethods |
List |
No |
Yes |
The allowed HTTP methods for cross-domain requests. |
The allowed HTTP methods for cross-domain access. Valid values:
|
|
AllowHeaders |
List |
No |
Yes |
The list of allowed headers for cross-domain requests. |
Specify the |
|
AllowOrigin |
List |
No |
Yes |
The list of allowed origins. |
Specify one or more values, or only the
|
|
AllowCredentials |
String |
No |
Yes |
Specifies whether to carry credentials. |
Valid values:
|
|
ExposeHeaders |
List |
No |
Yes |
The list of headers that can be exposed. |
Specify the |
|
MaxAge |
Integer |
No |
Yes |
The maximum cache duration of a preflight request in the browser. |
Unit: seconds. Valid values: -1 to 172800. |
Return values
Fn::GetAtt
-
RuleId: The ID of the forwarding rule.
-
ListenerId: The ID of the listener.
Examples
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
ListenerId:
Type: String
Description: |-
The ID of the listener that is configured for the Application Load Balancer (ALB)
instance.
Default: lsn-5tl4x9oav95yeb****
Resources:
Rule:
Type: ALIYUN::ALB::Rule
Properties:
RuleActions:
- FixedResponseConfig:
Content: dssacav
ContentType: text/plain
HttpCode: '200'
ForwardGroupConfig:
ServerGroupTuples:
- ServerGroupId: sgp-46ndzg2wz4v5mp****
InsertHeaderConfig:
Key: key
Value: ClientSrcPort
ValueType: SystemDefined
Order: 1
RedirectConfig:
Host: ${host}
HttpCode: '301'
Path: /test
Port: '10'
Protocol: HTTP
Query: quert
RewriteConfig:
Host: example.com
Path: /tsdf
Query: quedsa
Type: ForwardGroup
Priority: 10
RuleConditions:
- CookieConfig:
Values:
- Key: test
Value: test
HeaderConfig:
Key: port
Values:
- '5006'
HostConfig:
Values:
- www.example.com
MethodConfig:
Values:
- PUT
PathConfig:
Values:
- /test
QueryStringConfig:
Values:
- Key: test
Value: test
Type: Host
RuleName: MyTestRule
ListenerId:
Ref: ListenerId
Outputs:
RuleId:
Description: The ID of the forwarding rules.
Value:
Fn::GetAtt:
- Rule
- RuleId {
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"ListenerId": {
"Type": "String",
"Description": "The ID of the listener that is configured for the Application Load Balancer (ALB)\ninstance.",
"Default": "lsn-5tl4x9oav95yeb****"
}
},
"Resources": {
"Rule": {
"Type": "ALIYUN::ALB::Rule",
"Properties": {
"RuleActions": [
{
"FixedResponseConfig": {
"Content": "dssacav",
"ContentType": "text/plain",
"HttpCode": "200"
},
"ForwardGroupConfig": {
"ServerGroupTuples": [
{
"ServerGroupId": "sgp-46ndzg2wz4v5mp****"
}
]
},
"InsertHeaderConfig": {
"Key": "key",
"Value": "ClientSrcPort",
"ValueType": "SystemDefined"
},
"Order": 1,
"RedirectConfig": {
"Host": "${host}",
"HttpCode": "301",
"Path": "/test",
"Port": "10",
"Protocol": "HTTP",
"Query": "quert"
},
"RewriteConfig": {
"Host": "example.com",
"Path": "/tsdf",
"Query": "quedsa"
},
"Type": "ForwardGroup"
}
],
"Priority": 10,
"RuleConditions": [
{
"CookieConfig": {
"Values": [
{
"Key": "test",
"Value": "test"
}
]
},
"HeaderConfig": {
"Key": "port",
"Values": [
"5006"
]
},
"HostConfig": {
"Values": [
"www.example.com"
]
},
"MethodConfig": {
"Values": [
"PUT"
]
},
"PathConfig": {
"Values": [
"/test"
]
},
"QueryStringConfig": {
"Values": [
{
"Key": "test",
"Value": "test"
}
]
},
"Type": "Host"
}
],
"RuleName": "MyTestRule",
"ListenerId": {
"Ref": "ListenerId"
}
}
}
},
"Outputs": {
"RuleId": {
"Description": "The ID of the forwarding rules.",
"Value": {
"Fn::GetAtt": [
"Rule",
"RuleId"
]
}
}
}
}