You can configure the HTTP/S redirection feature to automatically redirect client HTTP requests to HTTPS at DCDN points of presence (POPs), enhancing security.
Prerequisites
An SSL certificate is configured. For more information, see Configure an HTTPS certificate.
Use cases
For an accelerated domain name that has an HTTPS certificate configured, you can enable HTTP/S redirection. By default, this feature uses a 301 redirect to automatically redirect client HTTP requests to HTTPS at DCDN POPs for enhanced security.
$ curl http://xxx xxx xxx/' -i
HTTP/1.1 301 Moved Permanently
Server: Tengine
Date: Mon, 03 Jun 2019 13:26:01 GMT
Content-Type: text/html
Content-Length: 278
Connection: keep-alive
Location: https://xxx xxx xxx/
Via: cache2.cn201[,0]
Timing-Allow-Origin: *
EagleId: 2a786b0215595683612635433e
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<h1>301 Moved Permanently</h1>
<p>The requested resource has been assigned a new permanent URI.</p>
<hr/>Powered by Tengine</body>
</html>
By default, the HTTP/S redirection feature uses the 301 redirect method. The 308 redirect method is also supported. If you need to change the redirect method, you can fill out a form.
|
HTTP status code |
Description |
Behavior |
Typical use case |
|
301 |
Moved Permanently |
The GET method does not change. Other methods might change to GET. |
Website restructuring. |
|
308 |
Permanent Redirect |
The request method and message body do not change. |
Website restructuring, typically for non-GET methods and operations. |
Procedure
-
Log on to the DCDN console.
-
In the left-side navigation pane, click Domain Names.
-
On the Domain Names page, find the target domain name and click Configure.
-
In the left-side navigation tree of the domain name, click HTTPS Settings.
In the HTTP/S Redirect section, click Modify.
In the HTTP/S Redirect dialog box, select a redirect type.
Redirect type
Description
Default
Both HTTP and HTTPS requests are accepted.
HTTPS -> HTTP
Redirects all HTTPS requests from clients to DCDN POPs to HTTP.
WarningIf you set the redirect type to HTTPS -> HTTP, do not configure HSTS at the same time. This combination creates a redirection loop and can make resources inaccessible.
HTTP -> HTTPS
Redirects all HTTP requests from clients to DCDN POPs to HTTPS to ensure data security.
Click OK.