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 instance, 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 based on an IP and port is not supported currently but will be available in later 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.
Use limits
The redirection configuration includes the protocol/port, domain name and destination directory. Note the following limitations to avoid redirect loops.
If the source directory is the same as the destination directory, the direction configuration is not allowed.
If the source directory is already configured with a redirection policy (including the source and redirection directory), the configuration is not allowed.
If the destination directory is used as the source directory of another redirection policy, the configuration is not allowed.
Prerequisites
The HTTPS:443
listener has been configured.
Directions
2. View the result of the HTTPS listener configuration, as shown below:
3. On the Redirection configurations tab of the CLB instance details page, click Create redirection policy. 4. Select Auto-redirection configuration, select the configured HTTPS listener and domain name, and select the redirection status code under Domain configuration. Click Submit.
Note:
Domain configuration for redirection is in beta testing. To try it out, please submit a ticket. The status codes are as follows: 301 (Moved Permanently), 302 (Move Temporarily), and 307 (Temporary Redirect). For more information, see HTTP/1.1 (RFC 7231). 5. View the result after redirection is configured, 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
2. View the result of the HTTPS configuration, as shown below: 3. On the Redirection configurations tab of the CLB instance details page, click Create redirection policy. 4. Select Manual Redirection Configuration, and then select the following: the originally accessed frontend protocol port, domain name, and path and the frontend protocol port, domain name, and path after redirection. Under Domain configuration, select the redirection status code, and select or clear the URL Reservation check box. Then click Submit. Note:
Domain configuration for redirection is in beta testing. To try it out, please submit a ticket. The status codes are as follows: 301 (Moved Permanently), 302 (Move Temporarily), and 307 (Temporary Redirect). For more information, see HTTP/1.1 (RFC 7231). 5. View the result of the redirection configuration, as shown below. As you can see, in the HTTPS:443
listener, https://www.example.com/forsale
is redirected to https://www.new.com/index
.
Was this page helpful?