全部產品
Search
文件中心

Server Load Balancer:GetListenerAttribute

更新時間:Oct 09, 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

CaCertificates

array<object>

CA 憑證清單。

object

CertificateId

string

CA 憑證 ID。

139a00*****

IsDefault

boolean

是否為預設憑證。取值:

  • true:是。

  • false:否。

true

Status

string

憑證狀態。

Associated

CaEnabled

boolean

是否開啟雙向認證。取值:

  • true:是。

  • false:否。

false

Certificates

array<object>

憑證清單。

object

憑證結構。

CertificateId

string

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

123157*******

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

監聽通訊協定。取值:HTTP、HTTPS 或 QUIC。

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。

說明

TracingEnabled 為 true 時,此值有效。

100

TracingType

string

Xtrace 的類型。合法取值為 Zipkin。

說明

TracingEnabled 為 true 時,此值有效。

Zipkin

QuicConfig

object

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

QuicListenerId

string

需要關聯的 QUIC 監聽 ID。QuicUpgradeEnabled 為 true 時必選。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

Tags

array<object>

標籤。

object

標籤結構。

Key

string

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

env

Value

string

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

product

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

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

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

XForwardedForHostEnabled

boolean

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

  • true:是。

  • false(預設值):否。

說明

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

false

XForwardedForProcessingMode

string

處理X-Forwarded-For標頭欄位的模式。只有當 XForwardedForEnabled 為 true 時,此值才會生效。取值:

  • 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

樣本

正常返回樣本

JSON格式

{
  "AclConfig": {
    "AclRelations": [
      {
        "AclId": "acl-doc****",
        "Status": "Associating"
      }
    ],
    "AclType": "White"
  },
  "CaCertificates": [
    {
      "CertificateId": "139a00*****",
      "IsDefault": true,
      "Status": "Associated"
    }
  ],
  "CaEnabled": false,
  "Certificates": [
    {
      "CertificateId": "123157*******"
    }
  ],
  "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",
  "Tags": [
    {
      "Key": "env",
      "Value": "product"
    }
  ],
  "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,
    "XForwardedForClientSourceIpsEnabled": false,
    "XForwardedForClientSourceIpsTrusted": "10.1.1.0/24",
    "XForwardedForClientSrcPortEnabled": true,
    "XForwardedForEnabled": true,
    "XForwardedForHostEnabled": false,
    "XForwardedForProcessingMode": "append",
    "XForwardedForProtoEnabled": true,
    "XForwardedForSLBIdEnabled": true,
    "XForwardedForSLBPortEnabled": true
  }
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

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

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

變更歷史

更多資訊,參考變更詳情。