全部產品
Search
文件中心

Server Load Balancer:CreateLoadBalancerHTTPSListener - 建立HTTPS監聽

更新時間:Dec 14, 2025

建立HTTPS監聽。

介面說明

注意事項

建立的監聽的狀態為 stopped。建立完成後,調用 StartLoadBalancerListener 介面啟動監聽來轉寄流量。

前提條件

您已經建立傳統型負載平衡,具體操作,請參見 CreateLoadBalancer

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

slb:CreateLoadBalancerHTTPSListener

create

*acl

acs:slb:{#regionId}:{#accountId}:acl/{#aclId}

*certificate

acs:slb:{#regionId}:{#accountId}:certificate/{#certificateId}

*loadbalancer

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

  • slb:tag
  • slb:tag
  • slb:tag

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

傳統型Server Load Balancer執行個體的地區 ID。

您可以從地區和可用性區域列表或通過調用 DescribeRegions 介面查詢地區 ID。

cn-hangzhou

LoadBalancerId

string

傳統型Server Load Balancer執行個體的 ID。

lb-bp1o94dp5i6earr****

Bandwidth

integer

監聽的頻寬峰值。單位:Mbps。

取值範圍:

  • -1:對於按流量計費的公網Server Load Balancer執行個體,可以將頻寬峰值設定為**-1**,即不限制頻寬峰值。

-1

ListenerPort

integer

執行個體前端使用的連接埠。

取值範圍:1~65535

80

BackendServerPort

integer

執行個體後端使用的連接埠,取值範圍:1~65535

如果不使用伺服器組(不指定 VServerGroupId),則該參數必選。

80

Tag

array<object>

標籤列表。

object

標籤列表。

Key

string

監聽的標籤鍵。N 的取值範圍:1~20。一旦傳入該值,則不允許為空白字串。最多支援 64 個字元,不能以aliyunacs:開頭,不能包含http://https://

TestKey

Value

string

監聽的標籤值。N 的取值範圍:1~20。一旦傳入該值,可以為空白字串。最多支援 128 個字元,不能以acs:開頭,不能包含http://或者https://

TestValue

XForwardedFor

string

是否通過X-Forwarded-For擷取來訪者用戶端 IP。取值:

  • on:是。

  • off:否。

on

Scheduler

string

調度演算法。取值:

  • wrr:權重值越高的後端伺服器,被輪詢到的次數(機率)也越高。

  • rr:按照訪問順序依次將外部請求依序分發到後端伺服器。

wrr

StickySession

string

是否開啟會話保持。取值:

  • on:是。

  • off:否。

on

StickySessionType

string

Cookie 的處理方式。取值:insertserver

  • insert:植入 Cookie。

用戶端第一次訪問時,負載平衡會在返回請求中植入 Cookie(即在 HTTP/HTTPS 響應報文中插入 SERVERID),下次用戶端攜帶此 Cookie 訪問,負載平衡服務會將請求定向轉寄給之前記錄到的後端伺服器上。

  • server:重寫 Cookie。

負載平衡發現使用者自訂了 Cookie,將會對原來的 Cookie 進行重寫,下次用戶端攜帶新的 Cookie 訪問,負載平衡服務會將請求定向轉寄給之前記錄到的後端伺服器。

說明

StickySession 的值為 on 時,必須指定該參數。

insert

CookieTimeout

integer

Cookie 逾時時間。單位:秒。

取值:1~86400

說明

StickySessiononStickySessionTypeinsert 時,該參數必選。

500

Cookie

string

伺服器上配置的 Cookie。

長度為 1~200 個字元,只能包含 ASCII 英文字母和數字字元,不能包含半形逗號(,)、半形分號(;)或空格,也不能以貨幣符號($)開頭。

說明

StickySessiononStickySessionTypeserver 時,該參數必選。

testCookie

HealthCheck

string

是否開啟健全狀態檢查。取值:

  • on:是。

  • off :否。

on

HealthCheckMethod

string

監聽 HTTP 類型健全狀態檢查的健全狀態檢查方法。取值:headget

說明

HealthCheck 值為 on 時才會有效。

get

HealthCheckDomain

string

用於健全狀態檢查的網域名稱。取值:

  • $_ip: 後端伺服器的私網 IP。當指定了 IP 或該參數未指定時,負載平衡會使用各後端伺服器的私網 IP 當做健全狀態檢查使用的網域名稱。

  • domain:網域名稱長度為 1~80 個字元,只能包含英文字母、數字、半形句號(.)和短劃線(-)。

說明

HealthCheck 值為 on 時才會有效。

172.XX.XX.16

HealthCheckURI

string

用於健全狀態檢查的 URI。

URI 長度為 1~80 個字元,可包含英文字母、數字和-/.%?#&這些特殊字元。URI 不能只為/,但必須以/開頭。

說明

HealthCheck 值為 on 時才會有效。

/test/index.html

HealthyThreshold

integer

健全狀態檢查連續成功多少次後,將後端伺服器的健全狀態檢查狀態由 fail 判定為 success

取值:2~10

說明

HealthCheck 值為 on 時才會有效。

4

UnhealthyThreshold

integer

健全狀態檢查連續失敗多少次後,將後端伺服器的健全狀態檢查狀態由 success 判定為 fail

取值:2~10

說明

HealthCheck 值為 on 時才會有效。

4

HealthCheckTimeout

integer

接收來自健全狀態檢查的響應需要等待的時間。如果後端 ECS 在指定的時間內沒有正確響應,則判定為健全狀態檢查失敗。單位:秒。取值:1~300

說明

HealthCheck 值為 on 時才會有效。

3

HealthCheckConnectPort

integer

健全狀態檢查使用的連接埠。

取值:1~65535

說明

HealthCheck 值為 on 時才會有效。

8080

HealthCheckInterval

integer

健全狀態檢查的時間間隔。單位:秒。

取值:1~50

說明

HealthCheck 值為 on 時才會有效。

5

HealthCheckHttpCode

string

健全狀態檢查正常的 HTTP 狀態代碼,多個狀態代碼用半形逗號(,)分割。

取值:http_2xxhttp_3xxhttp_4xxhttp_5xx

說明

HealthCheck 值為 on 時才會有效。

http_2xx,http_3xx

ServerCertificateId

string

伺服器憑證的 ID。

idkp-123-cn-test-****

VServerGroupId

string

伺服器組 ID。

rsp-cige6j5e7p****

CACertificateId

string

CA 憑證 ID。

若既上傳 CA 憑證又上傳伺服器憑證,即採用雙向認證。

若使用者只上傳伺服器憑證,即為單向認證。

139a00604ad-cn-east-hangzh****

XForwardedFor_SLBIP

string

是否通過SLB-IP頭欄位擷取來訪者的 VIP(Virtual IP address)。取值:

  • on:是。

  • off :否。

on

XForwardedFor_SLBID

string

是否通過SLB-ID頭欄位擷取 SLB 執行個體 ID。取值:

  • on:是。

  • off :否。

on

XForwardedFor_proto

string

是否通過X-Forwarded-Proto頭欄位擷取 SLB 的監聽協議。取值:

  • on:是。

  • off :否。

on

Gzip

string

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

  • on:是。

  • off :否。

on

AclId

string

監聽綁定的存取原則組 ID。

說明

AclStatus 參數的值為 on 時,該參數必選。

acl-a2do9e413e0spzasx****

AclType

string

存取控制類型。取值:

  • white:僅轉寄來自所選存取控制策略組中設定的 IP 位址或位址區段的請求,白名單適用於只允許特定 IP 訪問的情境。設定白名單存在一定業務風險。一旦設定白名單,就只有白名單中的 IP 可以訪問負載平衡監聽。

如果開啟了白名單訪問,但存取原則組中沒有添加任何 IP,則負載平衡監聽會轉寄全部請求。

  • black:來自所選存取控制策略組中設定的 IP 位址或位址區段的所有請求都不會轉寄,黑名單適用於只限制某些特定 IP 訪問的情境。

如果開啟了黑名單訪問,但存取原則組中沒有添加任何 IP,則負載平衡監聽會轉寄全部請求。

說明

AclStatus 參數的值為 on 時,該參數有效。

white

AclStatus

string

是否開啟存取控制功能。取值:

  • on:是。

  • off :否。

off

Description

string

自訂監聽名稱。

長度限制為 1~256 個字元,支援中文、字母、數字、短劃線(-)、正斜線(/)、半形句號(.)和底線(_)。

HTTPS_443

IdleTimeout

integer

指定串連空閑逾時時間,取值範圍為1~60,預設值為 15。單位:秒。

在逾時時間內一直沒有訪問請求,負載平衡會暫時中斷當前串連,直到一下次請求來臨時重建立立新的串連。

12

RequestTimeout

integer

指定請求逾時時間,取值範圍為1~180,預設值為 60。單位:秒。

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

23

EnableHttp2

string

是否開啟 HTTP2 特性。取值:

  • on:是。

  • off :否。

off

TLSCipherPolicy

string

安全性原則包含 HTTPS 可選的 TLS 協議版本和配套的密碼編譯演算法套件。

  • tls_cipher_policy_1_0

    支援 TLS 版本: TLSv1.0、TLSv1.1 和 TLSv1.2。

    支援密碼編譯演算法套件:ECDHE-RSA-AES128-GCM-SHA256、ECDHE-RSA-AES256-GCM-SHA384、ECDHE-RSA-AES128-SHA256、ECDHE-RSA-AES256-SHA384、AES128-GCM-SHA256、AES256-GCM-SHA384、AES128-SHA256、AES256-SHA256、ECDHE-RSA-AES128-SHA、ECDHE-RSA-AES256-SHA、AES128-SHA、AES256-SHA 和 DES-CBC3-SHA。

  • tls_cipher_policy_1_1

    支援 TLS 版本: TLSv1.1 和 TLSv1.2。

    支援密碼編譯演算法套件:ECDHE-RSA-AES128-GCM-SHA256、ECDHE-RSA-AES256-GCM-SHA384、ECDHE-RSA-AES128-SHA256、ECDHE-RSA-AES256-SHA384、AES128-GCM-SHA256、AES256-GCM-SHA384、AES128-SHA256、AES256-SHA256、ECDHE-RSA-AES128-SHA、ECDHE-RSA-AES256-SHA、AES128-SHA、AES256-SHA 和 DES-CBC3-SHA。

  • tls_cipher_policy_1_2

    支援 TLS 版本:TLSv1.2。

    支援密碼編譯演算法套件:ECDHE-RSA-AES128-GCM-SHA256、ECDHE-RSA-AES256-GCM-SHA384、ECDHE-RSA-AES128-SHA256、ECDHE-RSA-AES256-SHA384、AES128-GCM-SHA256、AES256-GCM-SHA384、AES128-SHA256、AES256-SHA256、ECDHE-RSA-AES128-SHA、ECDHE-RSA-AES256-SHA、AES128-SHA、AES256-SHA 和 DES-CBC3-SHA。

  • tls_cipher_policy_1_2_strict

    支援 TLS 版本:TLSv1.2。

    支援密碼編譯演算法套件:ECDHE-RSA-AES128-GCM-SHA256、ECDHE-RSA-AES256-GCM-SHA384、ECDHE-RSA-AES128-SHA256、ECDHE-RSA-AES256-SHA384、ECDHE-RSA-AES128-SHA 和 ECDHE-RSA-AES256-SHA。

  • tls_cipher_policy_1_2_strict_with_1_3

    支援 TLS 版本:TLSv1.2 及 TLSv1.3。

    支援的密碼編譯演算法套件:TLS_AES_128_GCM_SHA256、TLS_AES_256_GCM_SHA384、TLS_CHACHA20_POLY1305_SHA256、TLS_AES_128_CCM_SHA256、TLS_AES_128_CCM_8_SHA256、ECDHE-ECDSA-AES128-GCM-SHA256、ECDHE-ECDSA-AES256-GCM-SHA384、ECDHE-ECDSA-AES128-SHA256、ECDHE-ECDSA-AES256-SHA384、ECDHE-RSA-AES128-GCM-SHA256、ECDHE-RSA-AES256-GCM-SHA384、ECDHE-RSA-AES128-SHA256、ECDHE-RSA-AES256-SHA384、ECDHE-ECDSA-AES128-SHA、ECDHE-ECDSA-AES256-SHA、ECDHE-RSA-AES128-SHA、ECDHE-RSA-AES256-SHA。

tls_cipher_policy_1_1

XForwardedFor_SLBPORT

string

是否通過XForwardedFor_SLBPORT頭欄位擷取Server Load Balancer執行個體的監聽連接埠。取值:

  • on:是。

  • off:否。

off

XForwardedFor_ClientSrcPort

string

是否通過XForwardedFor_ClientSrcPort頭欄位擷取訪問Server Load Balancer執行個體用戶端的連接埠。取值:

  • on:是。

  • off:否。

off

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

CEF72CEB-54B6-4AE8-B225-F876FF7BA984

樣本

正常返回樣本

JSON格式

{
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 ParamDuplicateError The specified parameter value of XForwardedFor_ClientCertSubjectDNAlias is duplicate. Please change to a different one.
400 IpVersionConflict The ip version of this LoadBalancer and the Acl is conflict.
400 InvalidParameter.IdleTimeout The specified IdleTimeout exceeds the limit.
400 InvalidParameter.RequestTimeout The specified RequestTimeout exceeds the limit.
400 ListenerForwardNotSupport X-Forward-For is not supported to a ipv6 instance.
400 InvalidParameter.RegionNotSupport The region does not support the parameter: %s.
400 InvalidParameter.SpecNotSupport The loadBalancer of shared spec does not support the parameter: %s.
400 ListenerProcessing A previous configuration of the listener is pending,please try again later.
400 Certkey.Forbidden The specified certkey is not owned by the current user.
400 InvalidParameter.ListenerPortConflict There is conflict listener port exists.
400 ResourceNotAvailible.HttpsListener The specified Zone did not have enough resource.
400 AclNotExist Acl does not exist.
400 OperationUnsupported.CreateLoadBalancerLayer7Listener The slb instance does not support create HTTP or HTTPS listener.
400 InvalidParameter.VServerGroupId The MasterSlaveServerGroup can not be attached to HTTP or HTTPS listener.
400 MissingParam.HealthCheckDomain The HealthCheckDomain is required when HealthCheckHttpVersion is http1.1.
400 InvalidParameter.HealthCheckHttpVersion The param HealthCheckHttpVersion is invalid.
400 Duplicated.AclEntry %s.
400 CertificateNotExist The specified CertificateId does not exist.
400 OperationFailed.InsufficientResources The loadbalancer does not support this operation because of insufficient resources.
400 InvalidTLSPolicyId.NotExist The specified TLS cipher policy does not exist.
400 TLSPolicyConfiguring The specified TLS cipher policy is configuring.
400 TLSCipherPolicyVipRelationOverLimit The number of listeners associated with a policy has exceeded.
400 CertificateTypeMismatched The certificate type does not match.
400 MissingParam.ServerCertificates Server certificates are required.
400 TooManyCertificates The number of certificates must not be greater than one.
400 CnCertificateNotSupport The cn certificate is not support.
400 InvalidParam.CertificateBindingType The param CertificateBindingType is invalid.
400 InvalidParamSize.ServerCertificates The size of param ServerCertificates is invalid.
400 TooManyCertificates.ServerCertificates The number of certificates must not be greater than one.
400 SPEC_NOT_SUPPORT_PARAMETER Share spec does not support the feature.
400 LbNotSupportTcpssl You cannot create a TCP SSL type listener for the specified load balancer.
400 LbSupportTcpsslOnly The specified load balancer supports TCP SSL type listener only.
400 ListenerNotSupportRule You cannot create a rule for the specified listener.
400 Mismatch.SlbSpecTypeAndListenerProtocol The SlbSpecType and ListenerProtocol are mismatched.
400 InvalidParam.TagValue %s.
400 InvalidParam.TagKey %s.
400 SizeLimitExceeded.Tag %s.
400 MissingParam.TagKey The param MissingParam.TagKey is missing.
400 AclListenerOverLimit This acl has reached the limit of binding to listeners.
400 QuotaLimitExceeds.AclAttachedToListener The number of Acl bound listeners has reached the quota limit
400 QuotaLimitExceeds.TotalAclEntry The number of Acl entries has reached the quota limit.
400 QuotaLimitExceeds.AclListenerOverLimit This acl has reached the limit of binding to listeners.
404 ResourceNotFound.Certificate The specified resource is not found.

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

變更歷史

更多資訊,參考變更詳情