Problem description
After CDN or Dynamic Route for CDN is configured on the origin server, you can access the origin server from a browser. The following error message is displayed. This topic takes CDN as an example.
XXX.XXX.XXX redirect you too many times.
Try to clear Cookie.
ERR_TOO_MANY_REDIRECTS
Cause
The HTTP redirection to HTTPS feature is enabled on the origin site, and the back-to-origin Port configured in the CDN console is 80. In this case, the client uses HTTP or HTTPS to request the origin site, and the HTTP port 80 is triggered to forcibly redirect requests to the origin site. Then, the origin server requires CDN to resend an HTTPS request. However, CDN still sends an HTTP request and redirects requests to the origin server. In this case, users may encounter repeated redirection problems, which may result in errors.
Solution
Troubleshoot the problem
- Open the developer mode of the browser, switch to the Network tab, and then visit the source site again. 301 redirects are found more frequently.
- Use the domain name of the HTTP Origin Server to test whether the redirecting to HTTPS feature is enabled. Ensure that the back-to-origin Port set in the CDN console is 80.
Solution
This topic describes two solutions. You can choose one as needed.
Solution 1
Login CDN console to check, in domain name management page, click the target corresponding to the management and then click configuration, of the Alibaba Cloud CDN sends a back-to-source port is set to 443 and click determine . When this parameter is set to port 443, the CDN node sends a request to the origin server over HTTPS.
Solution 2
If you do not want to set the Origin port to 443, you can remove the HTTP Port. In this case, you can disable the forced redirection of HTTP-to-HTTPS requests from the origin server.
References
Because CDN is used, all client requests are first sent to the CDN node. If you want a CDN node to obtain results of HTTPS requests sent by clients, you can configure HTTP force redirect in the CDN console. For more information, see configure force redirect.
Application scope
- CDN
- Dynamic Route for CDN