ListListeners

Updated at: 2025-02-20 07:09

Queries the listeners in a region.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
OperationAccess levelResource typeCondition keyAssociated operation
alb:ListListenersget
*LoadBalancer
acs:alb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ParameterTypeRequiredDescriptionExample
NextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results. Valid values:

  • You do not need to specify this parameter for the first request.
  • If a value is returned for NextToken, you must specify the token that is obtained from the previous query as the value of NextToken.
FFmyTO70tTpLG6I3FmYAXGKPd****
MaxResultsintegerNo

The maximum number of entries to return. This parameter is optional. Valid values: 1 to 100. If you do not specify this parameter, the default value 20 is used.

50
ListenerIdsarrayNo

The listener IDs. You can specify at most 20 listener IDs.

stringNo

The listener ID.

lsr-bp1bpn0kn908w4nbw****
LoadBalancerIdsarrayNo

The ALB instance ID. You can specify at most 20 instance IDs.

stringNo

The ALB instance ID.

lb-bp1b6c719dfa08ex*****
ListenerProtocolstringNo

The listener protocol. Valid values:

  • HTTP
  • HTTPS
  • QUIC
HTTP
Tagarray<object>No

The tags.

objectNo

The tags.

KeystringNo

The tag key. The tag key can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

env
ValuestringNo

The tag value. The tag value can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

product

Response parameters

ParameterTypeDescriptionExample
ParameterTypeDescriptionExample
object

The information about the listeners.

Listenersarray<object>

The listeners.

listenerobject

The listener.

DefaultActionsarray<object>

The default actions in the forwarding rules.

defaultActionobject

The action of the default forwarding rule.

ForwardGroupConfigobject

The configuration of the forwarding rule action. This parameter takes effect only when the action is ForwardGroup.

ServerGroupTuplesarray<object>

The server groups to which requests are forwarded.

serverGroupTupleobject

The server group to which requests are forwarded.

ServerGroupIdstring

The ID of the server group to which requests are forwarded.

rsp-cige6j****
Typestring

The action. ForwardGroup: forwards requests to multiple server groups.

ForwardGroup
GzipEnabledboolean

Indicates whether GZIP compression is enabled to compress specific types of files. Valid values:

  • true
  • false
false
Http2Enabledboolean

Indicates whether HTTP/2 is enabled. Valid values:

  • true
  • false
Note
Only HTTPS listeners support this parameter.
false
IdleTimeoutinteger

The timeout period of an idle connection. Unit: seconds. Valid values: 1 to 60.

If no request is received within the specified timeout period, ALB closes the connection. ALB establishes the connection again when a new connection request is received.

3
ListenerDescriptionstring

The name of the listener.

test
ListenerIdstring

The listener ID.

lsr-bp1bpn0kn908w4nbw****
ListenerPortinteger

The frontend port that is used by the ALB instance. Valid values: 1 to 65535.

80
ListenerProtocolstring

The listener protocol of the instance. Valid values:

  • HTTP
  • HTTPS
  • QUIC
HTTP
ListenerStatusstring

The status of the listener. Valid values:

  • Provisioning: The listener is being created.
  • Running: The listener is running.
  • Configuring: The listener is being configured.
  • Stopped: The listener is disabled.
Running
LoadBalancerIdstring

The ALB instance ID.

lb-bp1b6c719dfa08ex*****
LogConfigobject

The logging configurations.

AccessLogRecordCustomizedHeadersEnabledboolean

Indicates whether custom headers are carried in the access log. Valid values:

  • true
  • false
true
AccessLogTracingConfigobject

The configurations of xtrace.

TracingEnabledboolean

Indicates whether xtrace is enabled. Valid values:

  • true
  • false
Note
This parameter can be set to true only when the access log feature of ALB is enabled by setting AccessLogEnabled to true.
true
TracingSampleinteger

The sampling rate of xtrace. Valid values: 1 to 10000.

Note
This parameter takes effect when TracingEnabled is set to true.
100
TracingTypestring

The type of xtrace. The value is set to Zipkin.

Note
This parameter takes effect when TracingEnabled is set to true.
Zipkin
QuicConfigobject

The configurations of the QUIC listener associated with the ALB instance.

QuicListenerIdstring

The ID of the QUIC listener associated with the ALB instance. This parameter is required if the QuicUpgradeEnabled parameter is set to true. Only HTTPS listeners support this parameter.

Note
The existing listener and QUIC listener must be to the same ALB instance, and the QUIC listener has not been associated with an ALB instance.
lsr-bp1bpn908w4nbw****
QuicUpgradeEnabledboolean

Indicates whether QUIC upgrade is enabled. Valid values:

  • true
  • false
Note
Only HTTPS listeners support this parameter.
true
RequestTimeoutinteger

The timeout period of a request. Unit: seconds. Valid values: 1 to 180.

If no responses are received from the backend server within the specified timeout period, ALB returns an HTTP 504 error code to the client.

34
SecurityPolicyIdstring

The security policy.

Note
Only HTTPS listeners support this parameter.
tls_cipher_policy_1_1
XForwardedForConfigobject

The configuration of the XForward header.

XForwardedForClientCertClientVerifyAliasstring

The name of the custom header. This parameter takes effect only when XForwardedForClientCertClientVerifyEnabled is set to true.

The name must be 1 to 40 characters in length, and can contain lowercase letters, digits, hyphens (-), and underscores (_).

Note
Only HTTPS listeners support this parameter.
test_client-verify-alias_123456
XForwardedForClientCertClientVerifyEnabledboolean

Indicates whether the X-Forwarded-Clientcert-clientverify header is used to obtain the verification result of the client certificate. Valid values:

  • true
  • false
Note
Only HTTPS listeners support this parameter.
true
XForwardedForClientCertFingerprintAliasstring

The name of the custom header. This parameter takes effect only when XForwardedForClientCertFingerprintEnabled is set to true.

The name must be 1 to 40 characters in length, and can contain lowercase letters, digits, hyphens (-), and underscores (_).

Note
Only HTTPS listeners support this parameter.
test_finger-print-alias_123456
XForwardedForClientCertFingerprintEnabledboolean

Indicates whether the X-Forwarded-Clientcert-fingerprint header is used to retrieve the fingerprint of the client certificate. Valid values:

  • true
  • false
Note
Only HTTPS listeners support this parameter.
true
XForwardedForClientCertIssuerDNAliasstring

The name of the custom header. This parameter takes effect only when XForwardedForClientCertIssuerDNEnabled is set to true.

The name must be 1 to 40 characters in length, and can contain lowercase letters, digits, hyphens (-), and underscores (_).

Note
Only HTTPS listeners support this parameter.
test_issue-dn-alias_123456
XForwardedForClientCertIssuerDNEnabledboolean

Indicates whether the X-Forwarded-Clientcert-issuerdn header is used to retrieve information about the authority that issues the client certificate. Valid values:

  • true
  • false
Note
Only HTTPS listeners support this parameter.
true
XForwardedForClientCertSubjectDNAliasstring

The name of the custom header. This parameter takes effect only when XForwardedForClientCertSubjectDNEnabled is set to true.

The name must be 1 to 40 characters in length, and can contain lowercase letters, digits, hyphens (-), and underscores (_).

Note
Only HTTPS listeners support this parameter.
test_subject-dn-alias_123456
XForwardedForClientCertSubjectDNEnabledboolean

Indicates whether the X-Forwarded-Clientcert-subjectdn header is used to retrieve information about the owner of the client certificate. Valid values:

  • true
  • false
Note
Only HTTPS listeners support this parameter.
true
XForwardedForClientSrcPortEnabledboolean

Indicates whether the X-Forwarded-Client-Port header is used to retrieve the client port. Valid values:

  • true
  • false
Note
This parameter is returned only for HTTP and HTTPS listeners.
true
XForwardedForEnabledboolean

Specifies whether to use the X-Forwarded-For header to retrieve client IP addresses. Valid values:

  • true (default)
  • false
Note
  • If this parameter is set to true, the default value of the XForwardedForProcessingMode parameter is append. You can change it to remove.
  • If this parameter is set to false, the X-Forwarded-For header in the request is not modified in any way before the request is sent to backend servers.
  • Both HTTP and HTTPS listeners support this parameter.
  • true
    XForwardedForProcessingModestring

    Specifies how the X-Forwarded-For header is processed. This parameter takes effect only when XForwardedForEnabled is set to true. Valid values:

    • append (default)
    • remove
    Note
  • If this parameter is set to append, ALB appends the IP address of the last hop to the existing X-Forwarded-For header in the request before the request is sent to backend servers.
  • If this parameter is set to remove, ALB removes the X-Forwarded-For header in the request before the request is sent to backend servers, no matter whether the request carries the X-Forwarded-For header.
  • Both HTTP and HTTPS listeners support this parameter.
  • append
    XForwardedForProtoEnabledboolean

    Indicates whether the X-Forwarded-Proto header is used to retrieve the listener protocol. Valid values:

    • true
    • false
    Note
    This parameter is supported by HTTP, HTTPS, and QUIC listeners.
    true
    XForwardedForSLBIdEnabledboolean

    Specifies whether to use the SLB-ID header to retrieve the ID of the ALB instance. Valid values:

    • true
    • false
    Note
    This parameter is supported by HTTP, HTTPS, and QUIC listeners.
    true
    XForwardedForSLBPortEnabledboolean

    Indicates whether the X-Forwarded-Port header is used to retrieve the listener port of the ALB instance. Valid values:

    • true
    • false
    Note
    This parameter is supported by HTTP, HTTPS, and QUIC listeners.
    true
    XForwardedForClientSourceIpsEnabledboolean

    Indicates whether the X-Forwarded-For header is used to preserver client IP addresses for the ALB instance. Valid values:

    • true
    • false
    Note
    This parameter is returned only for HTTP and HTTPS listeners.
    false
    XForwardedForClientSourceIpsTrustedstring

    The trusted proxy IP address.

    ALB instances traverse the IP addresses in the X-Forwarded-For header from the rightmost IP address to the leftmost IP address. The first IP address that is not on the trusted IP address list is considered the client IP address. Requests from the client IP address are throttled.

    10.1.1.0/24
    XForwardedForHostEnabledboolean

    Specifies whether to use the X-Forwarded-Host header to retrieve client domain names. Valid values:

    • true
    • false (default)
    Note
    HTTP, HTTPS, and QUIC listeners all support this parameter.
    false
    Tagsarray<object>

    The tags.

    Tagobject

    The tags.

    Keystring

    The tag key. The tag key can be up to 128 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://.

    env
    Valuestring

    The tag value. The tag value can be up to 128 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://.

    product
    MaxResultsinteger

    The maximum number of entries returned.

    50
    NextTokenstring

    The position where the query stopped. If this parameter is not returned, all data is queried.

    FFmyTO70tTpLG6I3FmYAXGKPd****
    RequestIdstring

    The request ID.

    365F4154-92F6-4AE4-92F8-7FF34B540710
    TotalCountinteger

    The total number of entries returned.

    1000

    Examples

    Sample success responses

    JSONformat

    {
      "Listeners": [
        {
          "DefaultActions": [
            {
              "ForwardGroupConfig": {
                "ServerGroupTuples": [
                  {
                    "ServerGroupId": "rsp-cige6j****"
                  }
                ]
              },
              "Type": "ForwardGroup"
            }
          ],
          "GzipEnabled": false,
          "Http2Enabled": false,
          "IdleTimeout": 3,
          "ListenerDescription": "test",
          "ListenerId": "lsr-bp1bpn0kn908w4nbw****",
          "ListenerPort": 80,
          "ListenerProtocol": "HTTP",
          "ListenerStatus": "Running",
          "LoadBalancerId": "lb-bp1b6c719dfa08ex*****",
          "LogConfig": {
            "AccessLogRecordCustomizedHeadersEnabled": true,
            "AccessLogTracingConfig": {
              "TracingEnabled": true,
              "TracingSample": 100,
              "TracingType": "Zipkin"
            }
          },
          "QuicConfig": {
            "QuicListenerId": "lsr-bp1bpn908w4nbw****",
            "QuicUpgradeEnabled": true
          },
          "RequestTimeout": 34,
          "SecurityPolicyId": "tls_cipher_policy_1_1",
          "XForwardedForConfig": {
            "XForwardedForClientCertClientVerifyAlias": "test_client-verify-alias_123456",
            "XForwardedForClientCertClientVerifyEnabled": true,
            "XForwardedForClientCertFingerprintAlias": "test_finger-print-alias_123456",
            "XForwardedForClientCertFingerprintEnabled": true,
            "XForwardedForClientCertIssuerDNAlias": "test_issue-dn-alias_123456",
            "XForwardedForClientCertIssuerDNEnabled": true,
            "XForwardedForClientCertSubjectDNAlias": "test_subject-dn-alias_123456",
            "XForwardedForClientCertSubjectDNEnabled": true,
            "XForwardedForClientSrcPortEnabled": true,
            "XForwardedForEnabled": true,
            "XForwardedForProcessingMode": "append",
            "XForwardedForProtoEnabled": true,
            "XForwardedForSLBIdEnabled": true,
            "XForwardedForSLBPortEnabled": true,
            "XForwardedForClientSourceIpsEnabled": false,
            "XForwardedForClientSourceIpsTrusted": "10.1.1.0/24",
            "XForwardedForHostEnabled": false
          },
          "Tags": [
            {
              "Key": "env",
              "Value": "product"
            }
          ]
        }
      ],
      "MaxResults": 50,
      "NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****",
      "RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
      "TotalCount": 1000
    }

    Error codes

    HTTP status codeError codeError messageDescription
    HTTP status codeError codeError messageDescription
    403Forbidden.LoadBalancerAuthentication is failed for %s.Authentication is failed for %s.

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    Change timeSummary of changesOperation
    2025-01-06The Error code has changedView Change Details
    2024-12-20The Error code has changed. The response structure of the API has changedView Change Details
    2024-01-29The Error code has changedView Change Details
    • On this page (1)
    • Debugging
    • Authorization information
    • Request parameters
    • Response parameters
    • Examples
    • Error codes
    • Change history
    Feedback