Skip to content

Commit 7ffb8aa

Browse files
committed
Improve 3xx Redirection page
1 parent bd9d4aa commit 7ffb8aa

File tree

2 files changed

+110
-35
lines changed

2 files changed

+110
-35
lines changed

src/content/docs/support/troubleshooting/http-status-codes/1xx-informational.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Cloudflare supports WebSocket connections, which often involve the 101 Switching
4242

4343
## 102 Processing
4444

45-
102 Processing status code indicates that the server has received the request and is currently processing it, but the final response is not yet ready. This status code is only applicable to HTTP/1.1 and higher. For more information refer, to [RFC2518](https://tools.ietf.org/html/rfc2518).
45+
102 Processing status code indicates that the server has received the request and is currently processing it, but the final response is not yet ready. This status code is only applicable to HTTP/1.1 and higher. For more information, refer to [RFC2518](https://tools.ietf.org/html/rfc2518).
4646

4747
### Common use cases
4848

src/content/docs/support/troubleshooting/http-status-codes/3xx-redirection.mdx

Lines changed: 109 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,141 @@ title: 3xx Redirection
55

66
---
77

8-
## Overview
8+
3xx codes are a class of responses that indicate that the User-Agent must take another course of action to obtain the complete requested resource.
99

10-
3xx codes are a class of responses that suggest the User-Agent must follow another course of action to obtain the complete requested resource.
10+
The redirect location should be specified in one of the following ways:
1111

12-
Redirect Location should be set in either:
12+
- In the `Location` header field of the response, which is useful for automatic redirection.
13+
- In the payload of the response, optionally including a hyperlink to the correct location.
1314

14-
1. `Location` header field in the response, useful for automatic redirecting
15-
2. The payload of the response with a hyperlink (optional) to correction location
15+
## 300 Multiple Choices
1616

17-
## **300 Multiple Choices** **(**[**RFC7231**](https://tools.ietf.org/html/rfc7231)**)**
17+
The 300 Multiple Choices status indicates that multiple options are available for the requested resource, and the client may select one.
1818

19-
Multiple options for the resource that the client may follow. For instance, it could be used to present different format options for video, list files with different [extensions](https://en.wikipedia.org/wiki/File_extensions), or [word sense disambiguation](https://en.wikipedia.org/wiki/Word_sense_disambiguation).
19+
For more information, refer to [RFC7231](https://tools.ietf.org/html/rfc7231).
2020

21-
## **301 Moved Permanently** **(**[**RFC7231**](https://tools.ietf.org/html/rfc7231)**)**
21+
### Common use cases
2222

23-
Permanent URL redirect for the resource requested. The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs.
23+
The status is typically used when a resource is available in multiple representations or formats. For instance:
2424

25-
Cloudflare is able to generate these responses, avoiding the need to send a request to the origin server’s response through the use of Page Rules. Read how Cloudflare can help generate redirects using [Redirect Rules](/rules/url-forwarding/).
25+
- Offering multiple versions of a video in different formats (for example, MP4, AVI).
26+
- Providing a list of files with different [extensions](https://en.wikipedia.org/wiki/File_extensions) or compression types.
27+
- Presenting [word sense disambiguation](https://en.wikipedia.org/wiki/Word_sense_disambiguation) options for a term with multiple meanings.
2628

27-
## **302 Found (aka Temporary Redirect) (**[**RFC7231**](https://tools.ietf.org/html/rfc7231)**)**
29+
The response may include a `Location` header pointing to a preferred option or provide a payload with hyperlinks to the available choices, allowing the client to decide.
2830

29-
Similar to a 301 redirect, but is intended for temporary purposes only. User-Agent may automatically follow the `Location` header, but should not replace the current URI with it as a 301.
31+
### Cloudflare-specific information
3032

31-
Cloudflare is able to generate these responses, thus avoiding the need to send a request to the origin server’s response through the use of Page Rules. Read more How Cloudflare can help generate redirects using [Redirect Rules](/rules/url-forwarding/).
33+
Cloudflare generally bypasses the 300 Multiple Choices response for automated redirections to ensure optimal performance and user experience.
3234

33-
## **303 See Other (since HTTP/1.1)** **(**[**RFC7231**](https://tools.ietf.org/html/rfc7231)**)**
3435

35-
User-Agent should follow this redirect with a GET request. *Note: differs from 301 in that the resource at the redirect is not necessarily equivalent to what was requested*
36+
## 301 Moved Permanently
3637

37-
* Intended to be used in response to a POST or DELETE request to signal the origin server received data correctly and to allow appropriate cache behaviour.
38-
* The original 303 response is not cacheable, but the response to the 2nd request (`GET`) may be since it’s under a different URI.
38+
The 301 Moved Permanently status indicates that the requested resource has been assigned a new permanent URI. All future references to this resource should use one of the enclosed URIs.
3939

40-
## **304 Not Modified (**[**RFC 7232**](https://tools.ietf.org/html/rfc7232)**)**
40+
For more information, refer to [RFC7231](https://tools.ietf.org/html/rfc7231).
4141

42-
Signal to the client that the requested resource is available and valid in the cache. The origin server has not modified the resource that the request inquired about. Client can receive the payload for the specified resource without connecting to the origin server again thus it is redirecting the request to use the stored resource. Requirements for a cache that receives a 304 response are defined in [Section 4.3.4 of \[RFC7234\]](https://tools.ietf.org/html/rfc7234#section-4.3.4).
42+
### Common use cases
4343

44-
Prior to this response, the client sent a conditional GET or HEAD request specifying what resource it currently has stored. Server is giving the client the “OK” to use this resource as the most updated version in order to reduce the amount of data transmission between client and server.
44+
This status is commonly used to inform clients that:
4545

46-
* Must not have message body
47-
* Must contain any of the headers that would have been set prior to the mirrored 200 response: `Cache-Control, Content-Location, Date, ETag, Expires,` or `Vary.`
46+
- A resource has been permanently relocated to a new URI.
47+
- Search engines should update their indexes to reflect the new URI.
48+
- Bookmarks or other saved references should be updated.
4849

49-
When a request is made to Cloudflare that is stale and must be revalidated at the origin, Cloudflare will send a 304 response to confirm the version in our cache matched the version at origin. The response will include the `CF-Cache-Status: REVALIDATED` header and Cloudflare confirms the version using the `If-Modified-Since` header. For more information, refer to [ETag Headers](/cache/reference/etag-headers/).
50+
The response typically includes a `Location` header specifying the new URI. This enables automatic redirection by most User-Agents.
5051

51-
## **305 Use Proxy (deprecated) (**[**RFC7231**](https://tools.ietf.org/html/rfc7231)**)**
52+
### Cloudflare-specific information
5253

53-
Request must be fulfilled through proxy URI specified in `Location` header instead of through the origin. This status code has been deprecated due to security risks.
54+
Cloudflare can generate 301 Moved Permanently responses without needing to query the origin server. This is achieved through the use of Page Rules, which allow users to configure permanent redirects directly at the Cloudflare edge. For more information, refer to [Redirect Rules](/rules/url-forwarding/).
5455

55-
## **306 Switch Proxy (deprecated) (**[**RFC7231**](https://tools.ietf.org/html/rfc7231)**)**
56+
## 302 Found
5657

57-
Notification that following requests must be directed to the proxy specified.
58+
The 302 Found status, also referred to as a temporary redirect, indicates that the requested resource is temporarily located at a different URI. Unlike a 301 Moved Permanently status, which denotes a permanent relocation, the 302 Found status is specifically intended for temporary use.
5859

59-
## **307 Temporary Redirect (**[**RFC7231**](https://tools.ietf.org/html/rfc7231)**)**
60+
While the User-Agent may follow the `Location` header to retrieve the resource, it should not replace the current URI as it would for a 301 Moved Permanently.
6061

61-
A redirect similar to a 302 response except that the request method (e.g. GET, POST..) must not differ from what was used in the original request if automatically following the redirect.
62+
For more information, refer to [RFC7231](https://tools.ietf.org/html/rfc7231).
6263

63-
* User-Agent may automatically follow the `Location` header but should not replace the original URI
64+
### Common use cases
6465

65-
**308 Permanent Redirect (**[**RFC 7538**](https://tools.ietf.org/html/rfc7538#section-3)**)**
66+
This status is typically used to:
6667

67-
Permanent redirect similar to a 301 except the request method (e.g. GET, POST..) must not differ from what was used in the original request if automatically following the redirect.
68+
- Temporarily redirect traffic during maintenance or upgrades.
69+
- Direct users to an alternate resource without altering saved references.
70+
- A/B test different versions of a resource without making permanent changes.
6871

69-
* User-Agent should automatically follow the `Location` header
70-
* User-Agent should replace the original URI with the updated one in the Location or payload
72+
### Cloudflare-specific information
73+
74+
Cloudflare can generate these responses, eliminating the need to send a request to the origin server by using Page Rules. Learn more about how Cloudflare can help generate redirects with [Redirect Rules](/rules/url-forwarding/).
75+
76+
## 303 See Other (since HTTP/1.1)
77+
78+
The 303 See Other status indicates that the client should retrieve the resource at a different URI using a `GET` request. Unlike a 301 Moved Permanently redirect, the resource at the redirect location is not necessarily equivalent to the originally requested resource.
79+
80+
For more information, refer to [RFC7231](https://tools.ietf.org/html/rfc7231).
81+
82+
### Common use cases
83+
84+
The 303 status is typically used in response to a `POST` or `DELETE` request to indicate that the origin server has successfully processed the data and to support proper caching behavior.
85+
86+
Although the initial 303 response is not cacheable, the response to the subsequent `GET` request can be cached, as it is tied to a distinct URI.
87+
88+
### Cloudflare-specific information
89+
90+
Cloudflare allows for the configuration of 303 redirects through [Redirect Rules](/rules/url-forwarding/)., enabling seamless handling of these responses directly at the edge. This approach improves performance by avoiding unnecessary requests to the origin server.
91+
92+
## 304 Not Modified
93+
94+
The 304 Not Modified status indicates that the requested resource is available and valid in the client's cache. This means that the origin server has not modified the resource since the client's last request, allowing the client to use the cached resource without connecting to the origin server again. Requirements for caches receiving a 304 response are defined in [Section 4.3.4 of \[RFC7234\]](https://tools.ietf.org/html/rfc7234#section-4.3.4).
95+
96+
For more information, refer to [RFC 7232](https://tools.ietf.org/html/rfc7232).
97+
98+
### Common use cases
99+
100+
A 304 Not Modified response is used when the client sends a conditional `GET` or `HEAD` request to validate a cached resource. The server confirms that the cached version is still up to date, allowing the client to use it without re-downloading the resource. This helps reduce unnecessary data transmission and improves efficiency.
101+
102+
A 304 response contains:
103+
104+
- No message body: The 304 response itself does not include the actual resource (like an image or webpage content). Instead, it just confirms that the cached version is valid.
105+
- Required headers: The response includes important metadata (such as `Cache-Control`, `Content-Location`, `Date`, `ETag`, `Expires`, or `Vary`) that tells the client how to manage the cached resource. These headers are the same ones that would accompany the resource if it were sent with a 200 OK response.
106+
107+
### Cloudflare-specific information
108+
109+
When a stale request must be revalidated at the origin, Cloudflare sends a 304 response to confirm that the cached version matches the origin version. The response includes the `CF-Cache-Status: REVALIDATED` header, and Cloudflare validates the version using the `If-Modified-Since` header. For more information, refer to [ETag Headers](/cache/reference/etag-headers/).
110+
111+
## 305 Use Proxy (deprecated)
112+
113+
This status code indicates that the request must be routed through the proxy specified in the `Location` header instead of being sent directly to the origin server. However, due to security concerns, the 305 Use Proxy status code has been deprecated.
114+
115+
## 306 Switch Proxy (deprecated)
116+
117+
This status code indicates that subsequent requests should be sent through the specified proxy. However, the 306 Switch Proxy status code is deprecated and is no longer in use.
118+
119+
## 307 Temporary Redirect
120+
121+
The 307 Temporary Redirect status indicates that a requested resource has been temporarily moved to a different URI, as specified in the Location header. Unlike a 302 redirect, the original request method (for example, `GET` or `POST`) must remain unchanged when the redirect is followed automatically. This ensures that temporary changes to a resource's location do not disrupt the intended behavior of the request. User agents may automatically follow the redirect using the `Location` header but should not replace the original URI for future requests.
122+
123+
For more information, refer to [RFC7231](https://tools.ietf.org/html/rfc7231).
124+
125+
### Common use cases
126+
127+
The 307 status is useful for temporarily relocating resources during server maintenance or upgrades while ensuring the original request method is preserved. It is also commonly used to direct traffic to temporary URLs for promotions, campaigns, or special events without altering the original URI for future requests.
128+
129+
### Cloudflare-specific information
130+
131+
Cloudflare can handle 307 Temporary Redirect responses efficiently, enabling temporary redirects without requiring changes at the origin server. This can be configured using [Redirect Rules](/rules/url-forwarding/).
132+
133+
## 308 Permanent Redirect
134+
135+
The 308 Permanent Redirect status indicates that the requested resource has been permanently moved to a new URI, as specified in the `Location` header. Unlike a 301 redirect, the original request method (for example, `GET`, `POST`) must remain unchanged when automatically following the redirect. User agents should follow the redirect using the `Location` header and replace the original URI with the new one for subsequent requests.
136+
137+
For more information, refer to [RFC 7538](https://tools.ietf.org/html/rfc7538#section-3).
138+
139+
### Common use cases
140+
141+
The 308 Permanent Redirect status is commonly used for permanent resource relocation, API version upgrades, domain or path migrations, and maintaining method integrity in redirects. Additionally, it helps with SEO by transferring link equity to the new URI.
142+
143+
### Cloudflare-specific information
144+
145+
Cloudflare can handle 308 Permanent Redirects efficiently, ensuring redirection while maintaining request integrity. These redirects can be configured using [Redirect Rules](/rules/url-forwarding/).

0 commit comments

Comments
 (0)