After you configure 302 redirection on your origin server, Dynamic Route for CDN (DCDN) points of presence (POPs) process the HTTP 302 status code that is returned by your origin server instead of returning the status code to clients. This simplifies the request processing pipeline and accelerates content delivery.
Prerequisites
302 redirection is enabled on the origin server.
Background information
302 is an HTTP status code, which indicates that an existing resource is relocated and the request fails to access the resource. To address this issue, the server typically adds the Location header to the response header. After a client receives a response that carries the HTTP 302 status code and the Location header, the request is redirected to the address specified by the Location header to retrieve the resource.
How it works

- The client requests the
http://example.com/examplefile.txt
file from the POP. - The file is not cached on the POP. The POP requests the file from the origin server.
- The origin server receives the request and returns the HTTP 302 status code. The response header carries the Location header, which specifies an address:
http://www.example.org/examplefile.txt
. - The POP receives the response and redirects to the address
http://www.example.org/examplefile.txt
. - The POP obtains the file and caches it.
- The POP returns the obtained file to the client.
http://example.com/examplefile.txt
, the file is directly returned because the file is already cached on POPs. Usage notes
- If not: When the origin server returns the HTTP 302 status code and the Location header that specifies a URL to the POP, the request is redirected to the URL specified by the Location header. The value of the Host header in the request is the domain name specified by the Location header.
- If so: When the origin server returns the HTTP 302 status code and the Location header that specifies a URL to the POP, the Host header in the back-to-origin request is the Host header configured for the accelerated domain name. By default, the Host header value is the accelerated domain name. If you require that the Host header value in the back-to-origin request must be the domain name specified by the Location header, an error occurs. If you want DCDN to support this requirement, submit a ticket.
Procedure
- Log on to the DCDN console.
- In the left-side navigation pane, click Domain Names.
- On the Domain Names page, find the domain name that you want to manage, and click Configure in the Actions column.
- In the left-side navigation pane of the domain name, click Origin Fetch.
- On the Origin Fetch tab, find the 302 Redirection section.
- Turn on 302 Redirection.
- Click Modify and set the following parameters.
Parameter Description Maximum 302 Redirects Specify the maximum number of times that a POP can redirect to the address specified by the Location header for each request. If the maximum value is exceeded, the HTTP 302 status code is returned to the user. Valid values: 1 to 5. Default value: 2. Note The maximum number of 302 redirects determines the number of back-to-origin redirects that can be redirected to the origin server by a POP.Maximum number of back-to-origin redirects = Maximum number of 302 redirects + 1. In this case, the default maximum number of back-to-origin redirects is 3, and valid values are 2 to 6.
Retain Parameters in 302 Redirects - Yes: Request parameters are retained during 302 redirects. The request parameters are passed to the server specified by the Location header.
- No: Request parameters are not retained during 302 redirects.
Retain Request Headers in 302 Redirects - Yes: Request headers are retained during 302 redirects. The request parameters are passed to the server specified by the Location header.
- No: Request headers are not retained during 302 redirects.
- Click OK.