全部產品
Search
文件中心

Server Load Balancer:GetListenerAttribute

更新時間:Sep 02, 2026

查詢監聽的詳細資訊。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

alb:GetListenerAttribute

get

*LoadBalancer

acs:alb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}

  • acs:ResourceTag

請求參數

名稱

類型

必填

描述

樣本值

ListenerId

string

監聽 ID。

lsn-o4u54y73wq7b******

返回參數

名稱

類型

描述

樣本值

object

查詢監聽器的詳細資訊。

AclConfig

object

ACL 配置結構。

AclRelations

array<object>

監聽器綁定的存取控制清單群組 ID 清單。

object

監聽器綁定的存取控制清單群組結構。

AclId

string

監聽器綁定的存取控制清單群組 ID。

acl-doc****

Status

string

ACL 與監聽器關聯的狀態。取值:

  • Associating:關聯中。

  • Associated:已關聯。

  • Dissociating:解除關聯中。

Associating

AclType

string

存取控制類型。取值:

  • White:僅轉發來自所選存取控制清單群組中設定的 IP 位址或位址區段的請求,白名單適用於應用程式只允許特定 IP 存取的場景。設定白名單存在一定業務風險。一旦設定白名單,就只有白名單中的 IP 可以存取負載平衡監聽器。

    如果開啟了白名單存取,但存取控制清單群組中沒有新增任何 IP,則負載平衡監聽器會轉發全部請求。

  • Black:來自所選存取控制清單群組中設定的 IP 位址或位址區段的所有請求都不會轉發,黑名單適用於應用程式只限制某些特定 IP 存取的場景。

    如果開啟了黑名單存取,但存取控制清單群組中沒有新增任何 IP,則負載平衡監聽器會轉發全部請求。

White

Certificates

array<object>

憑證清單。

object

憑證結構。

CertificateId

string

憑證 ID,目前僅支援伺服器憑證。

123157*******

CaCertificates

array<object>

CA 憑證清單。

object

CertificateId

string

CA 憑證 ID。

139a00*****

Status

string

憑證狀態。

Associated

IsDefault

boolean

是否為預設憑證。取值:

  • true:是。

  • false:否。

true

CaEnabled

boolean

是否啟用雙向驗證。取值:

  • true:是。

  • false:否。

false

DefaultActions

array<object>

預設規則動作清單。

array<object>

預設規則動作結構。

ForwardGroupConfig

object

轉發動作對應的配置,類型為 ForwardGroup 時有效。

ServerGroupTuples

array<object>

轉發目標伺服器群組。

object

轉發目標伺服器群組。

ServerGroupId

string

轉發到的目的伺服器群組 ID。

sgp-i5qt20******

Type

string

動作類型。

取值:ForwardGroup,表示轉發至多個伺服器群組。

ForwardGroup

GzipEnabled

boolean

是否啟用 Gzip 壓縮,對特定檔案類型進行壓縮。取值:

  • true:是。

  • false:否。

true

Http2Enabled

boolean

是否啟用 HTTP/2 特性。取值:

  • true:是。

  • false:否。

說明

僅 HTTPS 監聽器支援此參數。

true

IdleTimeout

integer

指定連線空閒逾時時間。單位:秒。

如果在逾時時間內一直沒有存取請求,負載平衡會暫時中斷目前連線,直到下一次請求來臨時重新建立新的連線。

2

ListenerDescription

string

自訂監聽器名稱。

HTTP_80

ListenerId

string

監聽 ID。

lsn-o4u54y73wq7b******

ListenerPort

integer

負載平衡執行個體前端使用的連接埠。

80

ListenerProtocol

string

監聽器通訊協定。取值:HTTPHTTPSQUIC

HTTP

ListenerStatus

string

目前監聽器的狀態。取值:

  • Provisioning:建立中。

  • Running:執行中。

  • Configuring:配置中。

  • Stopped:已停止。

Running

LoadBalancerId

string

應用程式負載平衡執行個體 ID。

alb-bd6oylbckp6k9x****

LogConfig

object

日誌配置資訊。

AccessLogRecordCustomizedHeadersEnabled

boolean

存取日誌是否啟用攜帶自訂標頭欄位。取值:

  • true:是。

  • false:否。

true

AccessLogTracingConfig

object

存取日誌 Xtrace 相關的配置資訊。

TracingEnabled

boolean

Xtrace 功能狀態。取值:

  • true:是。

  • false:否。

說明

只有執行個體存取日誌開關(AccessLogEnabled)開啟時,才能設定為 true

true

TracingSample

integer

Xtrace 的取樣率。取值:1~10000。

說明

TracingEnabledtrue 時,此值有效。

100

TracingType

string

xtrace 的類型。合法取值為 Zipkin

說明

TracingEnabledtrue 時,此值有效。

Zipkin

QuicConfig

object

啟用關聯 QUIC 監聽器時的配置資訊。

QuicListenerId

string

需要關聯的 QUIC 監聽器 ID。QuicUpgradeEnabledtrue 時必選。HTTPS 監聽器時有效。

說明

原始監聽器和關聯的 QUIC 監聽器必須屬於同一個 ALB 執行個體,並且此 QUIC 監聽器之前沒有被關聯過。

lsn-ek6ad66t****

QuicUpgradeEnabled

boolean

是否啟用 QUIC 升級。取值:

  • true:是。

  • false:否。

說明

僅 HTTPS 監聽器時有效。

true

RequestId

string

請求 ID。

365F4154-92F6-4AE4-92F8-7FF******

RequestTimeout

integer

指定請求逾時時間。單位:秒。

如果在逾時時間內後端伺服器一直沒有回應,負載平衡將放棄等待,給用戶端返回 HTTP 504 錯誤碼。

34

SecurityPolicyId

string

安全性原則。

說明

僅 HTTPS 監聽器支援此參數。

tls_cipher_policy_1_1

XForwardedForConfig

object

XForward 欄位設定資訊。

XForwardedForClientCertClientVerifyAlias

string

自訂標頭名稱。僅當 XForwardedForClientCertClientVerifyEnabled 的值為 true 時,此值才會生效,否則該值不會生效。

取值限制:長度為 1~40 個字元。支援字母 a~z、連字號(-)、底線(_)和數字。

說明

僅 HTTPS 監聽支援此參數。

test_client-verify-alias_123456

XForwardedForClientCertClientVerifyEnabled

boolean

是否透過 X-Forwarded-Clientcert-clientverify 標頭欄位取得存取負載平衡執行個體用戶端憑證的驗證結果。取值:

  • true:是。

  • false:否。

說明

僅 HTTPS 監聽支援此參數。

true

XForwardedForClientCertFingerprintAlias

string

自訂標頭名稱,僅當 XForwardedForClientCertFingerprintEnabled 的值為 true 時生效。

取值限制:長度為 1~40 個字元。支援字母 a~z、連字號(-)、底線(_)和數字。

說明

僅 HTTPS 監聽支援此參數。

test_finger-print-alias_123456

XForwardedForClientCertFingerprintEnabled

boolean

是否透過 X-Forwarded-Clientcert-fingerprint 標頭欄位取得存取負載平衡執行個體用戶端憑證的指紋值。取值:

  • true:是。

  • false:否。

說明

僅 HTTPS 監聽支援此參數。

true

XForwardedForClientCertIssuerDNAlias

string

自訂標頭名稱,僅當 XForwardedForClientCertIssuerDNEnabled 的值為 true 時,此值才會生效。

取值限制:長度為 1~40 個字元。支援字母 a~z、連字號(-)、底線(_)和數字。

說明

僅 HTTPS 監聽支援此參數。

test_issue-dn-alias_123456

XForwardedForClientCertIssuerDNEnabled

boolean

是否透過 X-Forwarded-Clientcert-issuerdn 標頭欄位取得存取負載平衡執行個體用戶端憑證的發行者資訊。取值:

  • true:是。

  • false:否。

說明

僅 HTTPS 監聽支援此參數。

true

XForwardedForClientCertSubjectDNAlias

string

自訂標頭名稱,僅當 XForwardedForClientCertSubjectDNEnabled 的值為 true 時,此值才會生效。

取值限制:長度為 1~40 個字元。支援字母 a~z、連字號(-)、底線(_)和數字。

說明

僅 HTTPS 監聽支援此參數。

test_subject-dn-alias_123456

XForwardedForClientCertSubjectDNEnabled

boolean

是否透過 X-Forwarded-Clientcert-subjectdn 標頭欄位取得存取負載平衡執行個體用戶端憑證的主體資訊。取值:

  • true:是。

  • false:否。

說明

僅 HTTPS 監聽支援此參數。

true

XForwardedForClientSrcPortEnabled

boolean

是否透過 X-Forwarded-Client-Port 標頭欄位取得存取負載平衡執行個體用戶端的連接埠。取值:

  • true:是。

  • false:否。

說明

HTTP 和 HTTPS 監聽支援此參數。

true

XForwardedForEnabled

boolean

是否透過 X-Forwarded-For 標頭欄位取得訪客真實 IP。取值:

  • true(預設值):是。

  • false:否。

說明
  1. 設定為 true 時,XForwardedForProcessingMode 預設取值為 append,支援修改為 remove

  2. 設定為 false 時,將請求傳送至後端服務之前保留 X-Forwarded-For 標頭欄位,不做額外處理。

  3. HTTP 和 HTTPS 監聽支援此參數。

true

XForwardedForProcessingMode

string

處理 X-Forwarded-For 標頭欄位的模式。僅當 XForwardedForEnabledtrue 時,此值才會生效。取值:

  • append(預設值):附加。

  • remove:移除。

說明
  1. 設定為 append 時,將請求傳送至後端服務之前把最後一跳 IP 加入 X-Forwarded-For 標頭欄位。

  2. 設定為 remove 時,將請求傳送至後端服務之前移除 X-Forwarded-For 標頭,無論請求是否攜帶 X-Forwarded-For 標頭欄位。

  3. HTTP 和 HTTPS 監聽支援此參數。

append

XForwardedForProtoEnabled

boolean

是否透過 X-Forwarded-Proto 標頭欄位取得負載平衡執行個體的監聽通訊協定。取值:

  • true:是。

  • false:否。

說明

HTTP、HTTPS 和 QUIC 監聽支援此參數。

true

XForwardedForSLBIdEnabled

boolean

是否透過 SLB-ID 標頭欄位取得負載平衡執行個體 ID。取值:

  • true:是。

  • false:否。

說明

HTTP、HTTPS 和 QUIC 監聽支援此參數。

true

XForwardedForSLBPortEnabled

boolean

是否透過 X-Forwarded-Port 標頭欄位取得負載平衡執行個體的監聽連接埠。取值:

  • true:是。

  • false:否。

說明

HTTP、HTTPS 和 QUIC 監聽支援此參數。

true

XForwardedForClientSourceIpsEnabled

boolean

是否允許 ALB 從 X-Forwarded-For 標頭欄位中尋找真實用戶端 IP。取值:

  • true:是。

  • false:否。

說明

HTTP、HTTPS 監聽支援此參數。

false

XForwardedForClientSourceIpsTrusted

string

指定可信的代理 IP。

應用型負載平衡 ALB 會從後往前遍歷 X-Forwarded-For,選取第一個不在可信 IP 清單中的 IP 作為真實的用戶端 IP,該 IP 會被用於來源 IP 限速。

10.1.1.0/24

XForwardedForHostEnabled

boolean

是否啟用透過 X-Forwarded-Host 標頭欄位取得存取負載平衡執行個體用戶端的網域名稱。取值:

  • true:是。

  • false(預設值):否。

說明

HTTP、HTTPS 和 QUIC 監聽支援此參數。

false

Tags

array<object>

標籤。

object

標籤結構。

Key

string

標籤鍵。最多支援 128 個字元,不能以 aliyunacs: 開頭,不能包含 http://https://

env

Value

string

標籤值。最多支援 128 個字元,不能以 aliyunacs: 開頭,不能包含 http://https://

product

樣本

正常返回樣本

JSON格式

{
  "AclConfig": {
    "AclRelations": [
      {
        "AclId": "acl-doc****",
        "Status": "Associating"
      }
    ],
    "AclType": "White"
  },
  "Certificates": [
    {
      "CertificateId": "123157*******"
    }
  ],
  "CaCertificates": [
    {
      "CertificateId": "139a00*****",
      "Status": "Associated",
      "IsDefault": true
    }
  ],
  "CaEnabled": false,
  "DefaultActions": [
    {
      "ForwardGroupConfig": {
        "ServerGroupTuples": [
          {
            "ServerGroupId": "sgp-i5qt20******"
          }
        ]
      },
      "Type": "ForwardGroup"
    }
  ],
  "GzipEnabled": true,
  "Http2Enabled": true,
  "IdleTimeout": 2,
  "ListenerDescription": "HTTP_80",
  "ListenerId": "lsn-o4u54y73wq7b******",
  "ListenerPort": 80,
  "ListenerProtocol": "HTTP",
  "ListenerStatus": "Running",
  "LoadBalancerId": "alb-bd6oylbckp6k9x****",
  "LogConfig": {
    "AccessLogRecordCustomizedHeadersEnabled": true,
    "AccessLogTracingConfig": {
      "TracingEnabled": true,
      "TracingSample": 100,
      "TracingType": "Zipkin"
    }
  },
  "QuicConfig": {
    "QuicListenerId": "lsn-ek6ad66t****",
    "QuicUpgradeEnabled": true
  },
  "RequestId": "365F4154-92F6-4AE4-92F8-7FF******",
  "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"
    }
  ]
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

403 Forbidden.LoadBalancer Authentication is failed for %s. 負載平衡操作驗證失敗。
404 ResourceNotFound.Listener The specified resource %s is not found. 監聽器不存在。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情