All Products
Search
Document Center

CDN:Too many redirects after CDN acceleration

Last Updated:Apr 25, 2025

Issue

Browsers display the message when users access your domain name accelerated by CDN: "This page isn't working. <Your domain> redirected you too many times. (Error: ERR_TOO_MANY_REDIRECTS)".

重定向次数过多

Cause

A client requests an accelerated domain via HTTPS, but the CDN fetches content over HTTP. The origin server's HTTP to HTTPS redirect rules cause a loop, and when the browser's redirect limit is exceeded, it stops the request and reports an error.

The following diagram illustrates the process:

image
  1. The client sends a request to access the accelerated domain name (for example, https://example.alibabacloud.com/) over HTTPS protocol using port 443.

  2. By default, CDN fetches content from the origin server (for example, http://example.alibabacloud.com/) over HTTP protocol using port 80.

  3. The origin server has HTTP to HTTPS redirect rules configured.

    Therefore, when content is retrieved over HTTP protocol, the origin server returns a 301 or 302 status code in its response with URL using HTTPS protocol for redirection. Then the client follows the redirect rule and initiates a new request over HTTPS, ultimately reaching the accelerated domain name.

  4. This process creates a continuous cycle of redirections. Once the redirect limit in the browser is exceeded for a request, the browser stops the request and reports an error.

Solution

Follow these steps to resolve the issue:

Set the origin server port to 443

  1. Log on to the Alibaba Cloud CDN console.

  2. In the left-side navigation pane, click Domain Names.

  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.

  4. In the Origin Information section, click Modify in the Actions column.

  5. Change the port of the origin server to 443, and then click OK.

    配置端口

(Optional) Modify the origin protocol policy

Skip this step if the Origin Protocol Policy feature is not enabled.

  1. Log on to the Alibaba Cloud CDN console.

  2. In the left-side navigation pane, click Domain Names.

  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.

  4. In the left-side navigation tree of the domain name, click Origin Fetch.

  5. On the Configurations tab, find the Origin Protocol Policy section, and click Modify.

  6. Choose Follow for Protocol Type and click OK.

Purge the cache

  1. Log on to the Alibaba Cloud CDN console.

  2. In the left-side navigation pane, click Purge and Prefetch.

  3. For Operation, select Purge, and for Operation Method, select Directory.

  4. In the URL field, enter the base URL of your domain. Note that the URL must start with https:// or http:// and end with /.

    For example, if the accelerated domain name is https://www.example.com/image/static/1.png, enter https://www.example.com/.

  5. Click Submit to start the cache purge task.

  6. You can view the progress of the cache refresh task in the Records tab.

Clear your local browser cache

Take Chrome browser as an example:

  1. In the upper-right corner of Chrome browser, click the More icon 展开 然后 Dlete Browsing Data...

  2. Select a time range, such as Last hour or All time.

  3. Select the types of information you want to delete. Cached images and files is required.

  4. Click Delete data.

Verify the setup

Verify using one of the following methods:

  • Run curl -I accelerated_domain_name (for example, curl -I https://www.example.com/image/static/1.png) in a terminal or command-line interface (CLI) of your operating system to check if the response header contains the Location header. If the Location header is absent, the issue has been resolved.

  • Use the browser's incognito mode to access the accelerated domain name.