Adding an HTTPS Listener
Scenarios
HTTPS listeners are best suited for applications that require encrypted transmission. Load balancers decrypt HTTPS requests before routing them to backend servers, which then send the processed requests back to load balancers for encryption before they are sent to clients.
When you add an HTTPS listener, ensure that the subnet of the load balancer has sufficient IP addresses. If the IP addresses are insufficient, add multiple subnets on the Basic Information page of the load balancer. After you select a subnet, ensure that ACL rules are not configured for this subnet. If rules are configured, request packets may not be allowed.
If you do not want to decrypt HTTPS requests, you can configure TCP listeners with the same port to transparently transmit HTTPS traffic to backend servers. For details, see Using TCP Listeners to Route HTTPS Traffic.
Adding an HTTPS Listener to shared Load Balancer
- Log in to the management console.
- In the upper left corner of the page, click
and select the desired region and project. - Click Service List. Under Network, click Elastic Load Balance.
- Locate the load balancer and click its name.
- Under Listeners, click Add Listener.
- Configure the listener based on Table 1 and click Next.
Table 1 Parameters for configuring a listener Parameter
Description
Example Value
Name
Specifies the listener name.
listener-pnqy
Frontend Protocol/Port
Specifies the protocol and port used by the load balancer to receive requests from clients and forward the requests to backend servers.
Port range: 1 to 65535
HTTPS/443
Server Certificate
Specifies the certificate used by the server to authenticate the client when HTTPS is used as the frontend protocol.
N/A
Enable SNI
Specifies whether to enable SNI when HTTPS is used as the frontend protocol.
SNI is an extension to TLS and is used when a server uses multiple domain names and certificates. This allows the client to submit the domain name information while sending an SSL handshake request. After the load balancer receives the request, the load balancer queries the corresponding certificate based on the domain name and returns it to the client. If no certificate is found, the load balancer will return a default certificate.
N/A
SNI Certificate
Specifies the certificate associated with the domain name when the frontend protocol is HTTPS and SNI is enabled.
N/A
Advanced Settings
Access Policy
Specifies how access to the listener is controlled. For more information, see Access Control. The following options are available:
- All IP addresses
- Blacklist
- Whitelist
Blacklist
IP Address Group
Specifies the IP address group associated with a whitelist or blacklist. If there is no IP address group, create one first. For more information, see IP Address Group.
ipGroup-b2
HTTP/2
Specifies whether HTTP/2 is supported if you select HTTPS for Frontend Protocol.
N/A
Security Policy
Specifies the security policy you can use if you select HTTPS as the frontend protocol. For more information, see Security Policy. The following options are available:
- Security Policy TLS-1-0
- Security Policy TLS-1-1
- Security Policy TLS-1-2
- Security Policy TLS-1-2-Strict
Security Policy TLS-1-0
Obtain Load Balancer EIP
Specifies whether to pass the load balancer EIP to backend servers if you select HTTPS for Frontend Protocol. You can enable this function only when you add listeners.
N/A
Idle Timeout
Specifies the length of time (in seconds) for a connection to be kept alive. If no request is received within this period, the load balancer closes the connection and establishes a new one with the client when the next request arrives.
60
Request Timeout
Specifies the length of time (in seconds) after which the load balancer closes the connection if the load balancer does not receive a request from the client.
60
Response Timeout
Specifies the length of time (in seconds) after which the load balancer sends a 504 Gateway Timeout error to the client if the load balancer receives no response from the backend server after routing a request to the backend server and receives no response after attempting to route the same request to other backend servers.
NOTE:If you have enabled sticky sessions and the backend server does not respond within the response timeout duration, the load balancer returns 504 Gateway Timeout to the clients.
60
Mutual Authentication
Specifies whether to enable mutual authentication between the server and client. Both a server certificate and CA certificate are required for mutual authentication. You can enable this option if you have set Frontend Protocol to HTTPS.
N/A
CA Certificate
Specifies the certificate used by the server to authenticate the client when HTTPS is used as the frontend protocol. This parameter is mandatory if you have set Frontend Protocol to HTTPS and enabled mutual authentication.
N/A
Description
Provides supplementary information about the listener.
N/A
- Set backend server group parameters by referring to Table 2 and health check parameters by referring to Table 3, and click Finish.
Table 2 Parameters for configuring a backend server group Parameter
Description
Example Value
Backend Server Group
Specifies a group of servers that have the same features and receive requests from the load balancer. Two options are available:
- Create new
- Use existing NOTE:
To associate an existing backend server group, ensure that it is not in use. Select the backend server group with the correct protocol. For example, if the frontend protocol is TCP, the backend protocol can only be TCP.
Create new
Name
Specifies the name of the backend server group.
server_group-sq4v
Backend Protocol
Specifies the protocol used by backend servers to receive requests. The backend protocol is HTTP by default.
HTTP
Load Balancing Algorithm
Specifies the algorithm used by the load balancer to distribute traffic.
- Weighted round robin: Requests are distributed across backend servers in sequence based on their weights. Backend servers with higher weights receive proportionately more requests, whereas equal-weighted servers receive the same number of requests.
- Weighted least connections: This algorithm is designed based on the least connections algorithm that uses the number of active connections to each backend server to make its load balancing decision. In addition to the number of connections, each server is assigned a weight based on its capacity. Requests are routed to the server with the lowest connections-to-weight ratio.
- Source IP hash: The source IP address of each request is calculated using the consistent hashing algorithm to obtain a unique hash key, and all backend servers are numbered. The generated key allocates the client to a particular server. This allows requests from different clients to be routed based on source IP addresses and ensures that a client is directed to the same server that it was using previously.
NOTE:- Choose an appropriate algorithm based on your requirements for better traffic distribution.
- For Weighted round robin or Weighted least connections, no access request will be routed to a server if its weight is 0.
Weighted round robin
Sticky Session
Specifies whether to enable sticky sessions. After sticky sessions are enabled, all requests from a client during one session are sent to the same backend server.
NOTE:- Sticky sessions can be enabled only if you select Weighted round robin or Weighted least connections for Load Balancing Algorithm.
- Enabling or disabling sticky sessions may interrupt services for a few seconds.
N/A
Sticky Session Type
Specifies the type of sticky sessions. Both Load balancer cookie and Application cookie are available when Frontend Protocol is set to HTTPS. Choose an appropriate sticky session type to better distribute requests and improve load balancing.
- Load balancer cookie: The load balancer generates a cookie after receiving a request from the client. All subsequent requests with the cookie are routed to the same backend server for processing.
- Application cookie: The application deployed on the backend server generates a cookie after receiving the first request from the client. All requests with the cookie are routed to this backend server.
Load balancer cookie
Cookie Name
Specifies the cookie name. If you have selected Application cookie, enter a cookie name.
cookieName-qsps
Stickiness Duration (min)
Specifies the minutes that sticky sessions are maintained. Set the stickiness duration if you have selected Weighted round robin as the load balancing algorithm and Load balancer cookie as the sticky session type. The stickiness duration ranges from 1 to 1440.
20
Description
Provides supplementary information about the backend server group.
N/A
Table 3 Parameters for configuring a health check Parameter
Description
Example Value
Enable Health Check
Specifies whether to enable health checks.
N/A
Protocol
Specifies the protocol used by the load balancer to perform health checks on backend servers. You can select either TCP or HTTP. A selected protocol cannot be changed.
HTTP
Domain Name
Specifies the domain name in the health check request. The domain name can contain digits, letters, hyphens (-), and periods (.), and must start with a digit or letter. This parameter is left blank by default and needs to be set only when the health check protocol is HTTP.
www.elb.com
Port
Specifies the port used by the load balancer to perform health checks on backend servers.
Port range: 1 to 65535
NOTE:This parameter is optional. If you do not specify a health check port, the port of each backend server will be used for health checks by default.
80
Advanced Settings
Interval (s)
Specifies the maximum time between health checks, in seconds.
The interval ranges from 1 to 50.
5
Timeout (s)
Specifies the maximum time required for waiting for a response from the health check, in seconds. The timeout ranges from 1 to 50.
10
Check Path
Specifies the health check URL, which is the destination on backend servers for health checks. This parameter is available only when Protocol is set to HTTP. The path can contain up to 80 characters.
/index.html
Maximum Retries
Specifies the maximum number of health check retries. The value ranges from 1 to 10.
3
- Click OK.
Adding an HTTPS Listener to a Classic Load Balancer
- Log in to the management console.
- In the upper left corner of the page, click
and select the desired region and project. - Click Service List. Under Network, click Elastic Load Balance.
- In the classic load balancer list, locate the load balancer and click its name.
- Under Listeners, click Add Listener. In the Add Listener dialog box, specify the parameters by referring to Table 4.
Table 4 Parameter description Parameter
Description
Example Value
Name
Specifies the listener name.
listener-ssgu
Frontend Protocol/Port
Specifies the protocol and port used by the load balancer to receive requests from clients and forward the requests to backend servers.
Port range: 1 to 65535
HTTPS/443
Backend Protocol/Port
Specifies the protocol and port used by backend servers to receive requests.
The backend protocol is HTTP by default, and the port numbers range from 1 to 65535.
HTTP/22
Load Balancing Algorithm
Specifies the algorithm used by the load balancer to distribute traffic.
- Round robin: Requests are distributed sequentially across all servers, so that the load is evenly shared.
- Least connections: a dynamic scheduling algorithm that estimates backend server load based on the number of active connections. Requests are routed to servers with the minimum number of connections.
- Source IP hash: The source IP address of each request is calculated using the consistent hashing algorithm to obtain a unique hash key, and all backend servers are numbered. The generated key allocates the client to a particular server. This allows requests from different clients to be routed based on source IP addresses and ensures that a client is directed to the same server that it was using previously.
NOTE:Choose an appropriate algorithm based on your requirements for better traffic distribution.
Round robin
Default Certificate
Specifies the certificate used by an HTTPS load balancer.
Select an existing certificate or create one. For details about how to create a certificate, see Certificate.
This parameter is available only if you select HTTPS as the frontend protocol.
N/A
SSL Protocol
Specifies the encryption protocol used by an HTTPS load balancer. This parameter is used to enable a specified encryption protocol. The following options are available:
- TLSv1.2
- TLSv1.2 TLSv1.1 TLSv1
This parameter is available only when HTTPS is used as the frontend protocol.
TLSv1.2
SSL Cipher
Specifies the cipher suite used by an HTTPS load balancer. The following options are available:
- Default Cipher
- Extended Cipher
- Strict Cipher
This parameter is available only when HTTPS is used as the frontend protocol. Extended Cipher is the only available choice when SSL Protocol is set to TLSv1.2 TLSv1.1 TLSv1.
Default Cipher
Sticky Session
Specifies whether to enable sticky sessions.
If you enable sticky sessions, all requests from a client during one session are sent to the same backend server.
NOTE:You can enable sticky sessions only if you have set Load Balancing Algorithm to Round robin.
N/A
Stickiness Duration (min)
Specifies the minutes that sticky sessions are maintained. The stickiness duration ranges from 1 to 1440.
5
Description
Provides supplementary information about the listener.
N/A
Health Check Protocol/Port
Specifies the protocol and port used for performing health checks on backend servers.
You can specify either TCP or HTTP. A selected protocol cannot be changed.
Port range: 1 to 65535
HTTP/80
Interval (s)
Specifies the maximum time between health checks, in seconds.
The interval ranges from 1 to 50.
5
Timeout (s)
Specifies the maximum time required for waiting for a response from the health check, in seconds.
The timeout duration ranges from 1 to 50.
10
Healthy Threshold
Specifies the number of consecutive health checks necessary for a backend server to be considered healthy. The threshold ranges from 1 to 10.
3
Unhealthy Threshold
Specifies the number of consecutive health checks necessary for a backend server to be considered unhealthy. The threshold ranges from 1 to 10.
3
Check Path
Specifies the health check URL, which is the destination on backend servers for health checks. This parameter is available only if you set Health Check Protocol to HTTP. The path can contain 1 to 80 characters and must start with a slash (/).
NOTE:The path can contain only letters, digits, and the following special characters: -/.%?#&_=
/test.html
- Click OK.
Using TCP Listeners to Route HTTPS Traffic
If you do not want to decrypt HTTPS requests, you can configure TCP listeners with the same port to transparently transmit HTTPS traffic to backend servers. In addition, configure an inbound security group rule with the protocol set to TCP and the port number same as the HTTPS listener to allow traffic from the load balancer.
The following figure shows how a TCP listener routes HTTPS traffic using port 443 to backend servers without decryption.
Last Article: Adding an HTTP Listener
Next Article: Adding a UDP Listener (with a QUIC Backend Server Group Associated)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.