After you use a CDN domain, the corresponding CDN node caches content from your origin server. Therefore, end users can retrieve the content from the CDN node more efficiently than from the origin server. If an end user requests content from the origin that has 302 redirects configured, the CDN node caches the Web page that the URL in the request points to. When other types of terminals request content with the same URL next time, these terminals retrieve the Web page cached on the CDN node. However, this Web page is not the target Web page after a 302 redirect. As a result, the origin server cannot respond to different terminals with adaptive content. How does CDN process 302 redirects from an origin server?


The style of a Web page displayed on a terminal depends on the terminal type. If the origin server responds to a request based on a 302 redirect, the target Web page after the 302 redirect is returned.

You can specify that the CDN node does not cache the Web page that the URL in a request points to, but caches the target Web page after a 302 redirect. Accordingly, different types of terminals can retrieve adaptive content from the origin server after 302 redirects through the CDN node. The same type of terminals can retrieve the content cached on the CDN node. Therefore, the content delivery is accelerated for all types of terminals. The CDN node can cache content based on directories and file extensions. You can configure the type of cached objects and the priorities of caching rules in the CDN console. Based on the directory structure of your website, you can specify that the CDN node will not cache the content that a requested URL points to. Instead, the CDN node caches the target content after a 302 redirect. For the same purpose, you can configure a policy on the origin server. This policy specifies that the content a requested URL points to will not be cached. This policy on the origin server has higher priority than the caching policies of CDN. Specifically, you can include the following header settings in the response for a requested URL:
  • Cache-Control: no-cache, no-store, private
  • Cache-Control: s-maxage=0, max-age=0
  • pragma: no-cache