Updated on 2024-01-05 GMT+08:00

HTTP Redirection to HTTPS

Scenarios

HTTPS is an extension of HTTP. HTTPS encrypts data between a web server and a browser.

If you enable redirection, all HTTP requests to your website are transmitted over HTTPS connections to improve security.

  • If the listener protocol is HTTP, only the GET or HEAD method can be used for redirection. If you create a redirect for an HTTP listener, the client browser will change POST or other methods to GET. If you want to use other methods rather than GET and HEAD, add an HTTPS listener.
  • HTTP requests are forwarded to the HTTPS listener as HTTPS requests, which are then routed to backend servers over HTTP.
  • If an HTTP listener is redirected to an HTTPS listener, no certificate can be deployed on the backend servers associated with the HTTPS listener. If certificates are deployed, HTTPS requests will not take effect.

Prerequisites

  • You have added an HTTPS listener.
  • You have added an HTTP listener.

Creating Redirection to HTTPS

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Hover on in the upper left corner to display Service List and choose Networking > Elastic Load Balance.
  4. Locate the load balancer and click its name.
  5. Click Listeners, locate the HTTP listener, and click its name.
  6. On the Forwarding Policies tab page, click Add Forwarding Policy.
    Table 1 Configuring parameters for redirection

    Parameter

    Setting

    Action

    Select Redirect to another listener.

    Listener

    Select the HTTPS listener to which requests are redirected.

  7. After the forwarding policy is added, click Save.
    Figure 1 Redirection to an HTTPS listener

  • If requests to an HTTP listener are redirected, the listener will become invalid, but access control to the listener will still take effect.
  • If you create a redirect for an HTTP listener, the backend server will return HTTP 301 Move Permanently to the clients.

Modifying Redirection to HTTPS

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Hover on in the upper left corner to display Service List and choose Networking > Elastic Load Balance.
  4. Locate the load balancer and click its name.
  5. Click Listeners, locate the HTTP listener, and click its name.
  6. On the Forwarding Policies tab page, locate the target forwarding policy and click Edit.
  7. You can change the HTTPS listener to which requests are redirected as required.
  8. Click Save.

Deleting Redirection to HTTPS

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Hover on in the upper left corner to display Service List and choose Networking > Elastic Load Balance.
  4. Locate the load balancer and click its name.
  5. Click Listeners, locate the listener, and click its name.
  6. On the Forwarding Policies tab page, click Delete on the right of the target forwarding policy.
  7. In the displayed dialog box, click Yes.