tencent cloud

Feedback

Layer-7 Redirection Configuration

Last updated: 2022-04-06 19:45:42

    CLB supports layer-7 redirection, so that you can configure redirection on layer-7 HTTP/HTTPS listeners.

    Note:

    • Session persistence: if the client accesses example.com/bbs/test/123.html and session persistence has been enabled on the backend CVM, after redirection is enabled to forward traffic to example.com/bbs/test/456.html, the original session persistence mechanism will not take effect.
    • TCP/UDP redirection: redirection at IP + port level is not supported currently but will be available in subsequent versions.

    Redirection Overview

    • Automatic redirection
      • Overview
        For an existing HTTPS:443 listener, an HTTP listener (port 80) will be created automatically by the system for forwarding. Requests sent to HTTP:80 will be automatically redirected to HTTPS:443.
      • Use case
        Forced HTTPS redirection, i.e., redirecting HTTP requests to HTTPS. When a user accesses a web service in a PC or mobile browser over HTTP, CLB will redirect all requests sent to HTTP:80 to HTTPS:443 for forwarding.
      • Strengths
        • Set-and-Forget configuration: forced HTTPS redirection can be implemented for a domain name with only one configuration operation needed.
        • Convenient update: if the number of URLs of the HTTPS service changes, you only need to use this feature again in the console for refreshing.
    • Manual redirection
    • Overview
      You can configure 1-to-1 redirection. For example, in a CLB instance, you can configure redirection of listener 1 / domain name 1 / URL 1 to listener 2 / domain name 2 / URL 2.
      Note:

      If the domain name has been configured with automatic redirection, you cannot configure manual redirection for it.

    • Use case
      Single-path redirection. For example, if you want to temporarily deactivate your web business in cases such as product sellout, page maintenance, or update and upgrade, the original page needs to be redirected to a new page. If no redirection is performed, the old address in a visitor's favorites and search engine database will return a 404/503 error message page, degrading the user experience and resulting in traffic waste.

    Automatic Redirection

    CLB supports one-click forced redirection from HTTP to HTTPS.
    Assume that you need to configure the website https://www.example.com, so that end users can visit it securely over HTTPS no matter whether they send HTTP requests (http://www.example.com) or HTTPS requests (https://www.example.com) in the browser.

    Prerequisites

    The HTTPS:443 listener has been configured.

    Directions

    1. Configure the CLB HTTPS listener in the CLB console and set up the web environment of https://example.com. For more information, see Configuring an HTTPS Listener.
    2. The result of the HTTPS listener configuration is as shown below:
    3. On the Redirection Configuration tab in CLB instance details, click Create a redirection policy.
    4. Select Auto-redirection Configuration, select the configured HTTPS listener and domain name, and click Next: Configure directory.
    5. Click Submit.
    6. The result after the redirection is configured is as shown below. As you can see, the HTTP:80 listener has been automatically configured for the HTTPS:443 listener, and all HTTP traffic will be automatically redirected to HTTPS.

    Manual Redirection

    CLB supports configuring 1-to-1 redirection.
    For example, your business uses a forsale page for a promotional campaign and needs to redirect the campaign page https://www.example.com/forsale to the new homepage https://www.new.com/index after the campaign ends.

    Prerequisites

    • An HTTPS listener has been configured.
    • The forwarding domain name https://www.example.com/forsale has been configured.
    • The forwarding domain name and path https://www.new.com/index has been configured.

    Directions

    1. Configure the CLB HTTPS listener in the CLB console and set up the web environment of https://example.com. For more information, see Configuring an HTTPS Listener.
    2. The result of the HTTPS configuration is as shown below:
    3. On the Redirection Configuration tab in CLB instance details, click Create a redirection policy.
    4. Select Manual Redirection Configuration, select the originally accessed frontend protocol port HTTPS:443 and domain name https://www.example.com/forsale, select the frontend protocol port HTTPS:443 and domain name https://www.new.com/index after redirection, and click Next: Configure direcotory.
    5. Select /forsale for the original access path and /index for the access path after redirection, and click Submit to complete the configuration.
    6. The result of the redirection configuration is as shown below. As you can see, in the HTTPS:443 listener, https://www.example.com/forsale has been redirected to https://www.new.com/index.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support