หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา
Adding a Listener
Function
This API is used to add a listener to a load balancer.
Constraints
When adding a listener, note the following:
-
For load balancing at Layer 4, the listener protocol can be TCP, UDP, or TLS.
-
For load balancing at Layer 7, the listener protocol can be HTTP, HTTPS or QUIC.
-
For load balancing both at Layer 4 and Layer 7, the listener protocol can be TCP, UDP, TLS, HTTP, HTTPS, or QUIC.
Calling Method
For details, see Calling APIs.
URI
POST /v3/{project_id}/elb/listeners
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
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 |
---|---|---|---|
listener |
Yes |
CreateListenerOption object |
Specifies the listener. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
admin_state_up |
No |
Boolean |
Specifies the administrative status of the listener. The value can only be true. |
default_pool_id |
No |
String |
Specifies the ID of the default backend server group. If there is no matched forwarding policy, requests will be forwarded to the default backend server for processing. |
client_ca_tls_container_ref |
No |
String |
Specifies the ID of the CA certificate used by the listener. Note:
|
default_tls_container_ref |
No |
String |
Specifies the ID of the server certificate used by the listener. This parameter is available only when the listener's protocol is HTTPS, TLS, or QUIC and type is set to server. |
description |
No |
String |
Provides supplementary information about the listener. |
http2_enable |
No |
Boolean |
Specifies whether to use HTTP/2 if you want the clients to use HTTP/2 to communicate with the load balancer. Request forwarding using HTTP/2 improves the access performance between your application and the load balancer. However, the load balancer still uses HTTP/1.x to forward requests to the backend server. Note:
|
insert_headers |
No |
ListenerInsertHeaders object |
Specifies the HTTP header fields that can transmit required information to backend servers. For example, the X-Forwarded-ELB-IP header field can transmit the EIP of the load balancer to backend servers. |
loadbalancer_id |
Yes |
String |
Specifies the ID of the load balancer that the listener is added to. Note: A listener can be added to only one load balancer. |
name |
No |
String |
Specifies the listener name. Note: If you leave the listener name empty, you cannot locate it on the listener list and view its details. |
project_id |
No |
String |
Specifies the project ID. |
protocol |
Yes |
String |
Specifies the protocol used by the listener. The value can be TCP, UDP, HTTP, HTTPS, TERMINATED_HTTPS, QUIC, or TLS. Note:
|
protocol_port |
No |
Integer |
Specifies the port used by the listener. Note:
|
sni_container_refs |
No |
Array of strings |
Specifies the IDs of SNI certificates (server certificates with domain names) used by the listener. Note:
|
sni_match_algo |
No |
String |
Specifies how wildcard domain name matches with the SNI certificates used by the listener. Value options:
|
tags |
No |
Array of Tag objects |
Lists the tags. |
tls_ciphers_policy |
No |
String |
Specifies the security policy used by the listener. Note: |
security_policy_id |
No |
String |
Specifies the ID of the custom security policy. Note: |
enable_member_retry |
No |
Boolean |
Specifies whether to enable health check retries for backend servers. Value options:
Note:
|
keepalive_timeout |
No |
Integer |
Specifies the idle timeout duration, in seconds. If there are no requests reaching the load balancer after the idle timeout duration elapses, the load balancer will disconnect the connection with the client and establish a new connection when there is a new request. Value ranges:
Note: This parameter is not supported by UDP listeners of shared load balancers. |
client_timeout |
No |
Integer |
Specifies the timeout duration for waiting for a response from a client, in seconds. There are two situations:
The value ranges from 1 to 300, and the default value is 60. This parameter is available only for HTTP and HTTPS listeners. |
member_timeout |
No |
Integer |
Specifies the timeout duration for waiting for a response from a backend server, in seconds. If the backend server fails to respond after the timeout duration elapses, the load balancer will stop waiting and return HTTP 504 Gateway Timeout to the client. The value ranges from 1 to 300, and the default value is 60. This parameter is available only for HTTP and HTTPS listeners. |
ipgroup |
No |
CreateListenerIpGroupOption object |
Specifies the IP address group associated with the listener. The value can be null, or left blank, or be an empty JSON structure ({}), indicating that no IP address group is associated with the listener. ipgroup_id is also required if you want to associate an IP address group with the listener. |
transparent_client_ip_enable |
No |
Boolean |
Specifies whether to pass source IP addresses of the clients to backend servers. Value options:
Note:
|
proxy_protocol_enable |
No |
Boolean |
Specifies whether to enable the ProxyProtocol option to pass the source IP addresses of the clients to backend servers. Note: This parameter is available only for TLS listeners and does not take effect for other types of listeners. |
enhance_l7policy_enable |
No |
Boolean |
Specifies whether to enable advanced forwarding. If advanced forwarding is enabled, more flexible forwarding policies and rules are supported. Value options:
The following scenarios are supported:
|
quic_config |
No |
Specifies the QUIC configuration for the current listener. Note:
|
|
cps |
No |
Integer |
Specifies the maximum number of new connections that a listener can handle per second. Value range: 0 to 1000000 Default value: 0, indicating that the number is not limited. Note: If the value is greater than the number defined in the load balancer specifications, the latter is used as the limit. |
connection |
No |
Integer |
Specifies the maximum number of concurrent connections that a listener can handle per second. Value range: 0 to 1000000 Default value: 0, indicating that the number is not limited. Note: If the value is greater than the number defined in the load balancer specifications, the latter is used as the limit. |
nat64_enable |
No |
Boolean |
Specifies whether to enable nat64_enable. This function enables a client to access IPv4 or IPv6 backend servers by accessing the IPv4 or IPv6 address of a load balancer. Constraints: This option can only be enabled for TCP and UDP listeners. nat64_enable is mutually exclusive with transparent_client_ip_enable. Value options: true: Enable nat64_enable. false: Disable nat64_enable. Default value: false |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Forwarded-ELB-IP |
No |
Boolean |
Specifies whether to transparently transmit the load balancer EIP to backend servers. If X-Forwarded-ELB-IP is set to true, the load balancer EIP will be stored in the HTTP header and passed to backend servers. |
X-Forwarded-Port |
No |
Boolean |
Specifies whether to transparently transmit the listening port of the load balancer to backend servers. If X-Forwarded-Port is set to true, the listening port of the load balancer will be stored in the HTTP header and passed to backend servers. |
X-Forwarded-For-Port |
No |
Boolean |
Specifies whether to transparently transmit the source port of the client to backend servers. If X-Forwarded-For-Port is set to true, the source port of the client will be stored in the HTTP header and passed to backend servers. |
X-Forwarded-Host |
No |
Boolean |
Specifies whether to rewrite the X-Forwarded-Host header. If X-Forwarded-Host is set to true, X-Forwarded-Host in the request header from the clients can be set to Host in the request header sent from the load balancer to backend servers. |
X-Forwarded-Proto |
No |
Boolean |
If X-Forwarded-Proto is set to true, the listener protocol of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
X-Real-IP |
No |
Boolean |
If X-Real-IP is set to true, the source IP address of the client can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-ELB-ID |
No |
Boolean |
If X-Forwarded-ELB-ID is set to true, the load balancer ID can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-TLS-Certificate-ID |
No |
Boolean |
If X-Forwarded-TLS-Certificate-ID is set to true, the certificate ID of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-TLS-Protocol |
No |
Boolean |
If X-Forwarded-TLS-Protocol is set to true, the algorithm protocol of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-TLS-Cipher |
No |
Boolean |
If X-Forwarded-TLS-Cipher is set to true, the algorithm suite of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
Specifies the tag key. |
value |
No |
String |
Specifies the tag value. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ipgroup_id |
Yes |
String |
Specifies the ID of the IP address group associated with the listener. Note:
|
enable_ipgroup |
No |
Boolean |
Specifies whether access control is enabled. Value options:
|
type |
No |
String |
Specifies how access to the listener is controlled. Value options:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
quic_listener_id |
Yes |
String |
Specifies the ID of the QUIC listener. This parameter is mandatory for creation and is optional for update. The listener specified by quic_listener_id must exist. The listener protocol must be QUIC and cannot be set to null, otherwise, it will conflict with enable_quic_upgrade. |
enable_quic_upgrade |
No |
Boolean |
Specifies whether to enable QUIC upgrade. Value options:
|
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the request ID. Note: The value is automatically generated. |
listener |
Listener object |
Specifies the listener. |
Parameter |
Type |
Description |
---|---|---|
admin_state_up |
Boolean |
Specifies the administrative status of the listener. |
client_ca_tls_container_ref |
String |
Specifies the ID of the CA certificate used by the listener. Note: This parameter is available only when type is set to client. |
connection_limit |
Integer |
Specifies the maximum number of connections that the load balancer can establish with backend servers. -1 indicates that the number of connections is not limited. Default value: -1 This parameter is unsupported. Please do not use it. |
created_at |
String |
Specifies the time when the listener was created, in the format of yyyy-MM-dd''T''HH:mm:ss''Z'', for example, 2021-07-30T12:03:44Z. |
default_pool_id |
String |
Specifies the ID of the default backend server group. If there is no matched forwarding policy, requests are forwarded to the default backend server. |
default_tls_container_ref |
String |
Specifies the ID of the server certificate used by the listener. |
description |
String |
Provides supplementary information about the listener. |
http2_enable |
Boolean |
Specifies whether to use HTTP/2 if you want the clients to use HTTP/2 to communicate with the load balancer. Request forwarding using HTTP/2 improves the access performance between your application and the load balancer. However, the load balancer still uses HTTP/1.x to forward requests to the backend server. Note:
|
id |
String |
Specifies the listener ID. |
insert_headers |
ListenerInsertHeaders object |
Specifies the HTTP header fields that can transmit required information to backend servers. For example, the X-Forwarded-ELB-IP header field can transmit the EIP of the load balancer to backend servers. |
loadbalancers |
Array of LoadBalancerRef objects |
Specifies the ID of the load balancer that the listener is added to. A listener can be added to only one load balancer. |
name |
String |
Specifies the listener name. Note: If you leave the listener name empty, you cannot locate it on the listener list and view its details. |
project_id |
String |
Specifies the ID of the project where the listener is used. |
enterprise_project_id |
String |
Specifies the ID of the enterprise project. |
protocol |
String |
Specifies the protocol used by the listener. The value can be TCP, UDP, HTTP, HTTPS, TERMINATED_HTTPS, QUIC, or TLS. Note:
|
protocol_port |
Integer |
Specifies the port used by the listener. Note:
|
sni_container_refs |
Array of strings |
Specifies the IDs of SNI certificates (server certificates with domain names) used by the listener. Note:
|
sni_match_algo |
String |
Specifies how wildcard domain name matches with the SNI certificates used by the listener. Value options:
|
tags |
Array of Tag objects |
Lists the tags. |
updated_at |
String |
Specifies the time when the listener was updated, in the format of yyyy-MM-dd''T''HH:mm:ss''Z'', for example, 2021-07-30T12:03:44Z. |
tls_ciphers_policy |
String |
Specifies the security policy used by the listener. Note: |
security_policy_id |
String |
Specifies the ID of the custom security policy. Note: |
enable_member_retry |
Boolean |
Specifies whether to enable health check retries for backend servers. Value options:
Note:
|
keepalive_timeout |
Integer |
Specifies the idle timeout duration, in seconds. If there are no requests reaching the load balancer after the idle timeout duration elapses, the load balancer will disconnect the connection with the client and establish a new connection when there is a new request. Value ranges:
Note: This parameter is not supported by UDP listeners of shared load balancers. |
client_timeout |
Integer |
Specifies the timeout duration for waiting for a response from a client, in seconds. There are two situations:
The value ranges from 1 to 300, and the default value is 60. This parameter is available only for HTTP and HTTPS listeners. |
member_timeout |
Integer |
Specifies the timeout duration for waiting for a response from a backend server, in seconds. If the backend server fails to respond after the timeout duration elapses, the load balancer will stop waiting and return HTTP 504 Gateway Timeout to the client. The value ranges from 1 to 300, and the default value is 60. This parameter is available only for HTTP and HTTPS listeners. |
ipgroup |
ListenerIpGroup object |
Specifies the IP address group associated with the listener. |
transparent_client_ip_enable |
Boolean |
Specifies whether to pass source IP addresses of the clients to backend servers. Value options:
Note:
|
proxy_protocol_enable |
Boolean |
Specifies whether to enable the ProxyProtocol option to pass the source IP addresses of the clients to backend servers. Note: This parameter is available only for TLS listeners and does not take effect for other types of listeners. |
enhance_l7policy_enable |
Boolean |
Specifies whether to enable advanced forwarding. If advanced forwarding is enabled, more flexible forwarding policies and rules are supported. Value options:
The following scenarios are supported:
|
quic_config |
ListenerQuicConfig object |
Specifies the QUIC configuration for the current listener. Note:
|
cps |
Integer |
Specifies the maximum number of new connections that a listener can handle per second. Value range: 0 to 1000000 Default value: 0, indicating that the number is not limited. Note: If the value is greater than the number defined in the load balancer specifications, the latter is used as the limit. |
connection |
Integer |
Specifies the maximum number of concurrent connections that a listener can handle per second. Value range: 0 to 1000000 Default value: 0, indicating that the number is not limited. Note: If the value is greater than the number defined in the load balancer specifications, the latter is used as the limit. |
nat64_enable |
Boolean |
Specifies whether to enable nat64_enable. This function enables a client to access IPv4 or IPv6 backend servers by accessing the IPv4 or IPv6 address of a load balancer. Constraints: This option can only be enabled for TCP and UDP listeners. nat64_enable is mutually exclusive with transparent_client_ip_enable. Value options: true: Enable nat64_enable. false: Disable nat64_enable. Default value: false |
Parameter |
Type |
Description |
---|---|---|
X-Forwarded-ELB-IP |
Boolean |
Specifies whether to transparently transmit the load balancer EIP to backend servers. If X-Forwarded-ELB-IP is set to true, the load balancer EIP will be stored in the HTTP header and passed to backend servers. |
X-Forwarded-Port |
Boolean |
Specifies whether to transparently transmit the listening port of the load balancer to backend servers. If X-Forwarded-Port is set to true, the listening port of the load balancer will be stored in the HTTP header and passed to backend servers. |
X-Forwarded-For-Port |
Boolean |
Specifies whether to transparently transmit the source port of the client to backend servers. If X-Forwarded-For-Port is set to true, the source port of the client will be stored in the HTTP header and passed to backend servers. |
X-Forwarded-Host |
Boolean |
Specifies whether to rewrite the X-Forwarded-Host header. If X-Forwarded-Host is set to true, X-Forwarded-Host in the request header from the clients can be set to Host in the request header sent from the load balancer to backend servers. |
X-Forwarded-Proto |
Boolean |
If X-Forwarded-Proto is set to true, the listener protocol of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
X-Real-IP |
Boolean |
If X-Real-IP is set to true, the source IP address of the client can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-ELB-ID |
Boolean |
If X-Forwarded-ELB-ID is set to true, the load balancer ID can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-TLS-Certificate-ID |
Boolean |
If X-Forwarded-TLS-Certificate-ID is set to true, the certificate ID of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-TLS-Protocol |
Boolean |
If X-Forwarded-TLS-Protocol is set to true, the algorithm protocol of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
X-Forwarded-TLS-Cipher |
Boolean |
If X-Forwarded-TLS-Cipher is set to true, the algorithm suite of the load balancer can be transferred to backend servers through the HTTP header of the packet. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Specifies the tag key. |
value |
String |
Specifies the tag value. |
Parameter |
Type |
Description |
---|---|---|
ipgroup_id |
String |
Specifies the ID of the IP address group associated with the listener. This parameter is mandatory when you create the IP address group and is optional when you update the IP address group. Note: The specified IP address group must exist, and the value cannot be null. |
enable_ipgroup |
Boolean |
Specifies whether access control is enabled. Value options:
A listener with access control enabled can be directly deleted. |
type |
String |
Specifies how access to the listener is controlled. Value options:
|
Parameter |
Type |
Description |
---|---|---|
quic_listener_id |
String |
Specifies the ID of the QUIC listener. This parameter is mandatory for creation and is optional for update. The listener specified by quic_listener_id must exist. The listener protocol must be QUIC and cannot be set to null, otherwise, it will conflict with enable_quic_upgrade. |
enable_quic_upgrade |
Boolean |
Specifies whether to enable QUIC upgrade. Value options:
|
Example Requests
-
Example 1: Adding a TCP listener
POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/listeners { "listener" : { "protocol_port" : 80, "protocol" : "TCP", "loadbalancer_id" : "098b2f68-af1c-41a9-8efd-69958722af62", "name" : "My listener", "admin_state_up" : true, "insert_headers" : { "X-Forwarded-ELB-IP" : true } } }
-
Example 2: Adding an HTTPS listener
POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/listeners { "listener" : { "protocol_port" : 90, "protocol" : "HTTPS", "loadbalancer_id" : "098b2f68-af1c-41a9-8efd-69958722af62", "name" : "My listener", "admin_state_up" : true, "ipgroup" : { "ipgroup_id" : "0416b6f1-877f-4a51-987e-978b3f083542", "type" : "black" }, "security_policy_id" : "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "default_tls_container_ref" : "233a325e5e3e4ce8beeb320aa714cc12" } }
Example Responses
Status code: 201
Normal response to POST requests.
{ "listener" : { "id" : "0b11747a-b139-492f-9692-2df0b1c87193", "name" : "My listener", "protocol_port" : 80, "protocol" : "TCP", "description" : null, "default_tls_container_ref" : null, "admin_state_up" : true, "loadbalancers" : [ { "id" : "098b2f68-af1c-41a9-8efd-69958722af62" } ], "client_ca_tls_container_ref" : null, "project_id" : "99a3fff0d03c428eac3678da6a7d0f24", "sni_container_refs" : [ ], "connection_limit" : -1, "member_timeout" : null, "client_timeout" : null, "keepalive_timeout" : null, "default_pool_id" : null, "ipgroup" : null, "tls_ciphers_policy" : "tls-1-2", "tags" : [ ], "created_at" : "2019-04-02T00:12:32Z", "updated_at" : "2019-04-02T00:12:32Z", "http2_enable" : false, "enable_member_retry" : true, "insert_headers" : { "X-Forwarded-ELB-IP" : true }, "transparent_client_ip_enable" : false, "nat64_enable" : false }, "request_id" : "f4c4aca8-df16-42e8-8836-33e4b8e9aa8e" }
Status Codes
Status Code |
Description |
---|---|
201 |
Normal response to POST requests. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot