Follow 301/302 Configuration

Last updated: 2020-06-02 14:29:59

    Configuration

    Tencent Cloud CDN does not cache 301/302 status codes by default. When an origin server returns a 301/302 request, the CDN node will return the response to the client by default, and the client will be redirected to the corresponding resource for access.

    When the follow 301/302 redirect configuration is enabled, the CDN node will be redirected when receiving a 301/302 redirect request during origin-pull until it gets the required resource (up to 3 follows are supported). It will then return the actual resource to the client, which does not need to be redirected.

    Configuration Guide

    Viewing the configuration

    Log in to the CDN Console, select Domain Management on the left sidebar, and click Manage to the right of the domain name to access its configuration page. Under the Origin Configuration tab, find Follow 301/302 Configuration, which is disabled by default:

    Modifying the configuration

    You can toggle the follow 301/302 redirect configuration switch to enable or disable this feature:

    If your acceleration domain name is configured for global acceleration, the follow 301/302 redirect configuration will take effect globally. It does not distinguish between requests from and outside of mainland China.

    Configuration Sample

    Suppose the follow 301/302 redirect configuration for the domain name cloud.tencent.com is as follows:

    User A requests a resource http://cloud.tencent.com/1.jpg. If the cache is not hit on the node, the node will request the resource from the origin server. If the HTTP response status code returned by the origin server is 302 and the redirect address is http://cloud.tencent.com/1.jpg, then:

    1. After follow 301/302 redirect is enabled, the node will directly initiate a request to the redirect address when it receives the HTTP response with the 301/302 status code.
    2. The resource will be obtained, cached to the node, and returned to the user.
    3. At this time, if user B also sends a request for http://cloud.tencent.com/1.jpg, the cache will be hit on the node and the resource will be returned to the user.
    4. After follow 301/302 redirect is enabled, up to 3 follows are allowed. If this limit is exceeded, the 301/302 status code will be returned to the user.

    Suppose the follow 301/302 redirect configuration for the domain name cloud.tencent.com is as follows:

    User A requests a resource http://cloud.tencent.com/1.jpg. If the cache is not hit on the node, the node will request the resource from the origin server. If the HTTP response status code returned by the origin server is 301/302 and the redirect address is http://xxx.tencent.com/1.jpg, then:

    1. The node will directly return the HTTP response to the user.
    2. When the user initiates a request for http://xxx.tencent.com/1.jpg, no acceleration will take effect if the domain name is not connected to CDN.
    3. At this time, if user B also sends a request for http://cloud.tencent.com/1.jpg, the process above will be repeated.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help