edit-icon download-icon

Simple routing - change HTTP to HTTPS

Last Updated: Jan 24, 2018

Prerequisites

The HTTP domain name access has been configured. For more information, see Simple routing - configure domain names.

Procedure

  1. HTTPS is supported at the Server Load Balancer layer. To support HTTPS, create a Server Load Balancer certificate.

    1. Log on to the Server Load Balancer console.

    2. Click Certificates in the left-side navigation pane and click Upload Certificate in the upper-right corner.

      1

    3. Enter the certificate information and click Confirm.

      For more information, see Certificate formats and Generate certificates.

      1

  2. After the certificate is successfully created, locate the Server Load Balancer instance that is assigned during cluster creation.

    When you create a cluster, Container Service assigns a Server Load Balancer instance to the cluster, and the instance only belongs to you.

    1. On the Container Service console, click Clusters in the left-side navigation pane. Click Manage at the right of the cluster (test in this example).

      1

    2. Click Load Balancer Settings in the left-side navigation pane and view the Server Load Balancer ID.

      1

    3. Click Products > Server Load Balancer to go to the Server Load Balancer console.

    4. View the IP address of the Server Load Balancer instance according to the instance ID.

      1

  3. Click Listeners in the left-side navigation pane and click Add Listener. The Add Listener dialog box appears. Enter the port information as follows:

    1. +----------------+-------+------+
    2. | | Protocol | Port |
    3. +----------------+-------+------+
    4. | Frontend protocol (port) | HTTPS | 443 |
    5. +----------------+-------+------+
    6. | Backend protocol (port) | HTTP | 9080 |
    7. +----------------+-------+------+
    1. Select HTTPS for the frontend protocol.

    2. Set the frontend port to 443 and backend port to 9080 (port 9080 is exposed by the routing service acsrouting_routing on each Elastic Compute Service (ECS) host. According to the HTTP HOST header, all the HTTP requests are forwarded on the routing service acsrouting_routing to corresponding containers that provide various services).

    3. Select the preceding certificate www.example.com.

    4. Complete other settings based on your needs.

    5. Click Next.

      1

  4. Complete the settings in the Health Check Configuration step and then click Confirm.

    You can select to disable or enable the health check. To enable the health check, enter your own domain name in the Domain Name field or enter /haproxy-monitor in the Health Check Path field. Otherwise, the health check reports an exception.

    1

  5. Click Confirm after the configurations.

    1

  6. Access the page https://www.example.com.

Subsequent operations

After the preceding configurations, to directly redirect to https://www.example.com after accessing http://www.example.com, see Simple routing - force to redirect from HTTP to HTTPS.

Thank you! We've received your feedback.