Standard BLB Listener Related Interfaces
CreateTCPListener: Create a TCP listener
Description
- Under a specified LoadBalancer, create a TCP listener to forward all TCP traffic received on a frontend port to the backend port on the real servers. TCP listeners only support TCP health checks where the check port aligns with the real server listener port.
Request structure
1POST /v{version}/blb/{blbId}/TCPlistener?clientToken={clientToken} HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "listenerPort":listenerPort,
7 "backendPort":backendPort,
8 "scheduler":scheduler,
9 "tcpSessionTimeout":tcpSessionTimeout,
10 "healthCheckType":healthCheckType,
11 "healthCheckTimeoutInSecond":healthCheckTimeoutInSecond,
12 "healthCheckInterval":healthCheckInterval,
13 "unhealthyThreshold":unhealthyThreshold,
14 "healthyThreshold":healthyThreshold
15}
Request headers
No special headers beyond common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number, current value is 1. |
| blbId | String | Yes | URL parameter | LoadBalancer identifier |
| listenerPort | int | Yes | RequestBody | The listener port, which shall be an integer between 1 and 65535. |
| backendPort | int | Yes | RequestBody | The listener port of real server, which shall be an integer between 1 and 65535. |
| scheduler | String | Yes | RequestBody | Load balancer algorithm supporting 3 methods: "RoundRobin"/"WeightLeastConn"/"Hash", among which "RoundRobin" means weighted round-robin, "WeightLeastConn" means weighted minimum connection counts, and "Hash" means source IP-based hashing. |
| tcpSessionTimeout | int | No | RequestBody | TCP connection timeout duration setting (unit: second). It is 900 by default, and shall be an integer between 10 and 4000. |
| healthCheckType | String | No | RequestBody | Health check protocol type, "TCP" by default. |
| healthCheckTimeoutInSecond | int | No | RequestBody | Health check timeout duration (unit: second). It is 3 by default, and shall be an integer between 1 and 60. |
| healthCheckInterval | int | No | RequestBody | Health check interval (unit: second). It is 3 by default, and shall be an integer between 1 and 10. |
| unhealthyThreshold | int | No | RequestBody | Unhealthy threshold represents the number of consecutive health check failures required to block the real server. Default is 3, and it must be an integer between 2 and 5. |
| healthyThreshold | int | No | RequestBody | Healthy threshold represents the number of consecutive successful health checks required to set the real server as available. Default is 3, and it must be an integer between 2 and 5. |
Response Status Code
Respond with 200 after successful operation, and respond with error codes after failed operation, as shown in [Error Codes](BLB/API Reference/Error code.md)
Response headers
No special headers beyond common headers.
Response parameters
None
Request example
1POST /v1/blb/lb-j8UqijYf/TCPlistener?clientToken=asdfg HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2016-04-10T08:26:52Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02
4
5{
6 "listenerPort":95,
7 "backendPort":95,
8 "scheduler":"LeastConnection",
9 "tcpSessionTimeout":900,
10 "healthCheckType":"TCP",
11 "healthCheckTimeoutInSecond":4,
12 "healthCheckInterval":5,
13 "unhealthyThreshold":2,
14 "healthyThreshold":3
15}
Response example
1HTTP/1.1 200 OK
2x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
3Date: Wed, 10 Apr 2016 08:26:52 GMT
4Transfer-Encoding: chunked
5Content-Type: application/json;charset=UTF-8
6Server: BWS
CreateUDPListener: Creates a UDP listener
Description
- Under the specified LoadBalancer, configure a UDP-based listener to monitor a frontend port and forward all UDP traffic to the backend port used by real servers. UDP listeners support both UDP and ICMP health checks, with the check port matching the real server's listener port.
Request structure
1POST /v{version}/blb/{blbId}/UDPlistener?clientToken={clientToken} HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "listenerPort":listenerPort,
7 "backendPort":backendPort,
8 "scheduler":scheduler,
9 "healthCheckType":healthCheckType,
10 "healthCheckTimeoutInSecond":healthCheckTimeoutInSecond,
11 "healthCheckInterval":healthCheckInterval,
12 "unhealthyThreshold":unhealthyThreshold,
13 "healthyThreshold":healthyThreshold,
14 "healthCheckString":healthCheck,
15 "udpSessionTimeout":udpSessionTimeout
16}
Request headers
No special headers beyond common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number, current value is 1. |
| blbId | String | Yes | URL parameter | LoadBalancer identifier |
| clientToken | String | Yes | Query | Idempotency Token, with length no more than 64 characters. |
| listenerPort | int | Yes | RequestBody | The listener port, which shall be an integer between 1 and 65535. |
| backendPort | int | Yes | RequestBody | The listener port of real server, which shall be an integer between 1 and 65535. |
| scheduler | String | Yes | RequestBody | Load balancer algorithm supporting 3 methods: "RoundRobin"/"WeightLeastConn"/"Hash", among which "RoundRobin" means weighted round-robin, "WeightLeastConn" means weighted minimum connection counts, and "Hash" means source IP-based hashing. |
| healthCheckType | String | No | RequestBody | Health check protocol type, which supports "UDP"/"ICMP", and is "UDP" by default. |
| healthCheckString | String | No | RequestBody | Health check request string. Real servers shall respond upon receipt. It shall be hexadecimal \00-\FF and standard ASCII strings, with the length up to 1299, and it is required when health check protocol is "UDP". |
| healthCheckTimeoutInSecond | int | No | RequestBody | Health check timeout duration (unit: second). It is 3 by default, and shall be an integer between 1 and 60. |
| healthCheckInterval | int | No | RequestBody | Health check interval (unit: second). It is 3 by default, and shall be an integer between 1 and 10. |
| unhealthyThreshold | int | No | RequestBody | Unhealthy threshold represents the number of consecutive health check failures required to block the real server. Default is 3, and it must be an integer between 2 and 5. |
| healthyThreshold | int | No | RequestBody | Healthy threshold represents the number of consecutive successful health checks required to set the real server as available. Default is 3, and it must be an integer between 2 and 5. |
| udpSessionTimeout | int | No | RequestBody | UDP session timeout duration. The default is 90 seconds, but it can be set as an integer between 5 and 4000 seconds. |
Response Status Code
Respond with 200 after successful operation, and respond with error codes after failed operation, as shown in [Error Codes](BLB/API Reference/Error code.md)
Response headers
No special headers beyond common headers.
Response parameters
None
Request example
1POST /v1/blb/lb-j8UqijYf/UDPlistener?clientToken=asdfg HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2016-04-10T08:26:52Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02
4
5{
6 "listenerPort":95,
7 "backendPort":95,
8 "scheduler":"LeastConnection",
9 "healthCheckType":"UDP",
10 "healthCheckString":"healthCheck",
11 "healthCheckTimeoutInSecond":4,
12 "healthCheckInterval":5,
13 "unhealthyThreshold":2,
14 "healthyThreshold":3,
15 "udpSessionTimeout":90
16}
Response example
1HTTP/1.1 200 OK
2x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
3Date: Wed, 10 Apr 2016 08:26:52 GMT
4Transfer-Encoding: chunked
5Content-Type: application/json;charset=UTF-8
6Server: BWS
CreateHTTPListener: Create an HTTP listener
Description
- Under the specified LoadBalancer, create an HTTP-based listener listening to a frontend port to forward all HTTP requests to the backend port listened to by real servers.
Request structure
1POST /v{version}/blb/{blbId}/HTTPlistener?clientToken={clientToken} HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "listenerPort":listenerPort,
7 "backendPort":backendPort,
8 "scheduler":scheduler,
9 "keepSession":keepSession,
10 "keepSessionType":keepSessionType,
11 "keepSessionDuration":keepSessionDuration,
12 "keepSessionCookieName":keepSessionCookieName,
13 "xForwardFor":xForwardFor,
14 "xForwardedProto":xForwardedProto
15 "healthCheckType":healthCheckType,
16 "healthCheckPort":healthCheckPort,
17 "healthCheckURI":healthCheckURI,
18 "healthCheckTimeoutInSecond":healthCheckTimeoutInSecond,
19 "healthCheckInterval":healthCheckInterval,
20 "unhealthyThreshold":unhealthyThreshold,
21 "healthyThreshold":healthyThreshold,
22 "healthCheckNormalStatus":healthCheckNormalStatus,
23 "healthCheckHost":healthCheckHost,
24 "serverTimeout":serverTimeout,
25 "redirectPort":redirectPort
26}
Request headers
No special headers beyond common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number, current value is 1. |
| blbId | String | Yes | URL parameter | LoadBalancer identifier |
| listenerPort | int | Yes | RequestBody | The listener port, which shall be an integer between 1 and 65535. |
| backendPort | int | Yes | RequestBody | The listener port of real server, which shall be an integer between 1 and 65535. |
| scheduler | String | Yes | RequestBody | Load balancer algorithm supporting 2 methods: "RoundRobin"/"LeastConnection", among which "RoundRobin" means weighted round-robin, and "LeastConnection" means minimum connection counts. |
| keepSession | bool | No | RequestBody | Whether to enable the session persistence function, meaning requests from the same client will be sent to the same real server. It is disabled by default. |
| keepSessionType | String | No | RequestBody | Cookie handling method for session persistence, valid only when the session persistence is enabled, supporting "insert"/"rewrite". It is "insert" by default. |
| keepSessionDuration | int | No | RequestBody | Cookie validity period for session persistence (unit: second). It is valid only when session persistence is enabled. It is 3600s by default, and shall be an integer between 1 and 15552000. |
| keepSessionCookieName | String | No | RequestBody | Cookie name to be overwritten for session persistence, valid only when the session persistence is enabled and keepSessionType="rewrite". |
| xForwardFor | bool | No | RequestBody | Whether to enable retrieving the real IP of the client. Once it is enabled, the real server can retrieve the real IP address of the client via the HTTP Header X-Forwarded-For. It is disabled by default. |
| xForwardedProto | bool | No | RequestBody | Forward the protocol used by the listener to the real server via the x-forwarded-proto HTTP Header. |
| healthCheckType | String | No | RequestBody | Health check protocol type, which supports "HTTP"/"TCP", and is "HTTP" by default. |
| healthCheckPort | int | No | RequestBody | Health check port. It is backendPort by default. |
| healthCheckURI | String | No | RequestBody | Health check URI. It is / by default. It is valid when the health check protocol is "HTTP". |
| healthCheckTimeoutInSecond | int | No | RequestBody | Health check timeout duration (unit: second). It is 3 by default, and shall be an integer between 1 and 60. |
| healthCheckInterval | int | No | RequestBody | Health check interval (unit: second). It is 3 by default, and shall be an integer between 1 and 10. |
| unhealthyThreshold | int | No | RequestBody | Unhealthy threshold represents the number of consecutive health check failures required to block the real server. Default is 3, and it must be an integer between 2 and 5. |
| healthyThreshold | int | No | RequestBody | Healthy threshold represents the number of consecutive successful health checks required to set the real server as available. Default is 3, and it must be an integer between 2 and 5. |
| healthCheckNormalStatus | String | No | RequestBody | HTTP status codes for successful health checks, supporting combinations of 5 types of status codes such as "http_1xx|http_2xx". It is "http_2xx|http_3xx" by default. It is valid when the health check protocol is "HTTP". |
| healthCheckHost | String | No | RequestBody | The header field of the Layer 7 health check request will include the specified host field, such as "localhost", and the default is "". It is valid when the health check protocol is "HTTP". |
| serverTimeout | int | No | RequestBody | Real server maximum timeout (unit: second). It is 30 s by default, and shall be an integer between 1 and 3600. |
| redirectPort | int | No | RequestBody | Requests received by this listener is forwarded to the HTTPS listener, which is specified through this port. |
Response Status Code
Respond with 200 after successful operation, and respond with error codes after failed operation, as shown in [Error Codes](BLB/API Reference/Error code.md)
Response headers
No special headers beyond common headers.
Response parameters
None
Request example
1POST /v1/blb/lb-j8UqijYf/HTTPlistener?clientToken=asdfg HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "listenerPort":95,
7 "backendPort":95,
8 "scheduler":"LeastConnection",
9 "healthCheckTimeoutInSecond":4,
10 "healthCheckInterval":5,
11 "unhealthyThreshold":2,
12 "xForwardFor":true,
13 "xForwardedProto":true,
14 "healthCheckType":"HTTP",
15 "serverTimeout":1800,
16 "healthCheckNormalStatus":"http_1xx|http_2xx",
17 "healthCheckHost":"localhost",
18 "redirectPort":80
19}
Response example
1HTTP/1.1 200 OK
2x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
3Date: Wed, 10 Apr 2016 08:26:52 GMT
4Transfer-Encoding: chunked
5Content-Type: application/json;charset=UTF-8
6Server: BWS
CreateHTTPSListener: Create an HTTPS listener
Description
Under the specified LoadBalancer, configure an HTTPS-based listener to monitor a frontend port. Convert incoming HTTPS requests on that port into HTTP requests through SSL termination, then forward them to the backend port used by real servers.
Request structure
1POST /v{version}/blb/{blbId}/HTTPSlistener?clientToken={clientToken} HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "listenerPort":listenerPort,
7 "backendPort":backendPort,
8 "scheduler":scheduler,
9 "keepSession":keepSession,
10 "keepSessionType":keepSessionType,
11 "keepSessionDuration":keepSessionDuration,
12 "keepSessionCookieName":keepSessionCookieName,
13 "xForwardFor":xForwardFor,
14 "xForwardedProto":xForwardedProto
15 "healthCheckType":healthCheckType,
16 "healthCheckPort":healthCheckPort,
17 "healthCheckURI":healthCheckURI,
18 "healthCheckTimeoutInSecond":healthCheckTimeoutInSecond,
19 "healthCheckInterval":healthCheckInterval,
20 "unhealthyThreshold":unhealthyThreshold,
21 "healthyThreshold":healthyThreshold,
22 "healthCheckNormalStatus":healthCheckNormalStatus,
23 "healthCheckHost":healthCheckHost,
24 "serverTimeout":serverTimeout,
25 "certIds":[certId],
26 "encryptionType":encryptionType,
27 "encryptionProtocols":[protocol1, protacol2],
28 "dualAuth":false,
29 "clientCertIds":[clientCertId],
30 "additionalCertDomains":[{"certId":certId,"host":host}]
31}
Request headers
No special headers beyond common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number, current value is 1. |
| blbId | String | Yes | URL parameter | LoadBalancer identifier |
| clientToken | String | Yes | Query | Idempotency Token, with length no more than 64 characters. |
| listenerPort | int | Yes | RequestBody | The listener port, which shall be an integer between 1 and 65535. |
| backendPort | int | Yes | RequestBody | The listener port of real server, which shall be an integer between 1 and 65535. |
| scheduler | String | Yes | RequestBody | Load balancer algorithm supporting 2 methods: "RoundRobin"/"LeastConnection", among which "RoundRobin" means weighted round-robin, and "LeastConnection" means minimum connection counts. |
| keepSession | boolean | No | RequestBody | Whether to enable the session persistence function, meaning requests from the same client will be sent to the same real server. It is disabled by default. |
| keepSessionType | String | No | RequestBody | Cookie handling method for session persistence, valid only when the session persistence is enabled, supporting "insert"/"rewrite". It is "insert" by default. |
| keepSessionDuration | int | No | RequestBody | Cookie validity period for session persistence (unit: second). It is valid only when session persistence is enabled. It is 3600s by default, and shall be an integer between 1 and 15552000. |
| keepSessionCookieName | int | No | RequestBody | Cookie name to be overwritten for session persistence, valid only when the session persistence is enabled and keepSessionType="rewrite". |
| xForwardFor | boolean | No | RequestBody | Whether to enable retrieving the real IP of the client. Once it is enabled, the real server can retrieve the real IP address of the client via the HTTP Header X-Forwarded-For. It is disabled by default. |
| xForwardedProto | boolean | No. | RequestBody | Forward the protocol used by the listener to the real server via the x-forwarded-proto HTTP Header. |
| healthCheckType | String | No | RequestBody | Health check protocol type, which supports "HTTP"/"TCP", and is "HTTP" by default. |
| healthCheckPort | int | No | RequestBody | Health check port. It is backendPort by default. |
| healthCheckURI | String | No | RequestBody | Health check URI. It is / by default. It is valid when the health check protocol is "HTTP". |
| healthCheckTimeoutInSecond | int | No | RequestBody | Health check timeout duration (unit: second). It is 3 by default, and shall be an integer between 1 and 60. |
| healthCheckInterval | int | No | RequestBody | Health check interval (unit: second). It is 3 by default, and shall be an integer between 1 and 10. |
| unhealthyThreshold | int | No | RequestBody | Unhealthy threshold represents the number of consecutive health check failures required to block the real server. Default is 3, and it must be an integer between 2 and 5. |
| healthyThreshold | int | No | RequestBody | Healthy threshold represents the number of consecutive successful health checks required to set the real server as available. Default is 3, and it must be an integer between 2 and 5. |
| healthCheckNormalStatus | String | No | RequestBody | HTTP status codes for successful health checks, supporting combinations of 5 types of status codes such as "http_1xx|http_2xx". It is "http_2xx|http_3xx" by default. It is valid when the health check protocol is "HTTP". |
| healthCheckHost | String | No | RequestBody | The header field of the Layer 7 health check request will include the specified host field, such as "localhost", and the default is "". It is valid when the health check protocol is "HTTP". |
| serverTimeout | int | No | RequestBody | Real server maximum timeout (unit: second). It is 30 s by default, and shall be an integer between 1 and 3600. |
| certIds | List |
Yes | RequestBody | Certificate to be loaded by the listener. Currently, only one certificate ID is allowed. If multiple IDs are uploaded, only the last one is valid. |
| encryptionType | String | No | RequestBody | Encryption option. It is tls_cipher_policy_default by default. Support: tls_cipher_policy_default/tls_cipher_policy_1_1/tls_cipher_policy_1_2/tls_cipher_policy_1_2_secure/userDefind. For corresponding encryption protocols and cipher suites, refer to [encryption](BLB/API Reference/Appendix.md#encryption). |
| encryptionProtocols | List |
No | RequestBody | When encryptionType is userDefined, the protocol type list is a string array composed of the combinations of three protocols: "tlsv10", "tlsv11" and "tlsv12" protocol. |
| appliedCiphers | String | No | RequestBody | For the cipher suite, refer to [encryption](BLB/API Reference/Appendix.md#encryption) Different suites shall be separated by colons ":". |
| dualAuth | boolean | No | RequestBody | Whether to enable mutual authentication, and it is disabled by default. |
| clientCertIds | List |
No | RequestBody | When dualAuth is true, the loaded client certificate chain currently only allows the uploading of one certificate ID. If multiple IDs are uploaded, only the last one is valid. |
| additionalCertDomains | List<[AdditionalCertDomain](BLB/API Reference/Appendix.md#AdditionalCertDomain)> | No | RequestBody | Extended domain name |
Response Status Code
Respond with 200 after successful operation, and respond with error codes after failed operation, as shown in [Error Codes](BLB/API Reference/Error code.md)
Response headers
No special headers beyond common headers.
Response parameters
None
1POST /v1/blb/lb-j8UqijYf/HTTPSlistener?clientToken=asdfg HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2016-04-10T08:26:52Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02
4
5{
6 "listenerPort":95,
7 "backendPort":95,
8 "scheduler":"LeastConnection",
9 "healthCheckTimeoutInSecond":4,
10 "healthCheckInterval":5,
11 "unhealthyThreshold":2,
12 "healthyThreshold":3,
13 "xForwardFor":true,
14 "xForwardedProto": true,
15 "healthCheckType":"HTTP",
16 "serverTimeout":1800,
17 "healthCheckNormalStatus":"http_1xx|http_2xx",
18 "healthCheckHost":"localhost",
19 "certIds":["cert-zfj2ey2z4kmm"]
20}
Response example
1HTTP/1.1 200 OK
2x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
3Date: Wed, 10 Apr 2016 08:26:52 GMT
4Transfer-Encoding: chunked
5Content-Type: application/json;charset=UTF-8
6Server: BWS
CreateSSLListener: Create SSL listener
Description
- Under the specified LoadBalancer, configure an SSL protocol-based listener to monitor a frontend port. Convert incoming SSL traffic on that port into TCP requests via SSL termination and forward them to the backend port used by real servers. SSL listeners only support TCP health checks, with the check port matching the real server's listener port.
Request structure
1POST /v{version}/blb/{blbId}/SSLlistener?clientToken={clientToken} HTTP/1.1
2Host: blb.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "listenerPort":listenerPort,
7 "backendPort":backendPort,
8 "scheduler":scheduler,
9 "healthCheckType":healthCheckType,
10 "healthCheckTimeoutInSecond":healthCheckTimeoutInSecond,
11 "healthCheckInterval":healthCheckInterval,
12 "unhealthyThreshold":unhealthyThreshold,
13 "healthyThreshold":healthyThreshold,
14 "certIds":[certId],
15 "encryptionType":encryptionType,
16 "encryptionProtocols":[protocol1, protacol2],
17 "dualAuth":false,
18 "clientCertIds":[clientCertId]
19}
Request headers
No special headers beyond common headers.
Request parameters
