Skip to content

Commit f6da843

Browse files
authored
[Rules] Update redirect status codes (#29792)
1 parent f50fefa commit f6da843

4 files changed

Lines changed: 28 additions & 15 deletions

File tree

src/content/docs/rules/url-forwarding/bulk-redirects/reference/parameters.mdx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 3
66
---
77

8-
import { Type, MetaInfo } from "~/components";
8+
import { Type, MetaInfo, Render } from "~/components";
99

1010
A URL redirect has a source URL, a target URL, a status code, and some additional parameters that affect its URL matching behavior and runtime behavior.
1111

@@ -70,13 +70,9 @@ For example, when both **Subpath matching** and **Preserve path suffix** are ena
7070

7171
## Status code
7272

73-
API field: `status_code` <Type text="Integer" /> <MetaInfo text="default: 301" />
73+
API field: `status_code` <Type text="Integer" /> <MetaInfo text="default: 301" /><br/>
74+
API values: `301`, `302`, `307`, or `308`.
7475

75-
The HTTP status code returned to the client when redirecting.
76+
The HTTP status code returned to the client when redirecting:
7677

77-
The value must be one of the following:
78-
79-
- `301` (Moved permanently)
80-
- `302` (Found, also known as Moved temporarily)
81-
- `307` (Temporary redirect)
82-
- `308` (Permanent redirect)
78+
<Render file="redirects-status-codes" product="rules" />

src/content/docs/rules/url-forwarding/single-redirects/settings.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ A wildcard URL redirect has the following configuration parameters:
2020

2121
- **Target URL**: Enter the target URL, which can be static (for example, `https://example.com`) or dynamic (for example, `https://example.com/${1}/files/${2}`). Use [wildcard replacement](/ruleset-engine/rules-language/functions/#wildcard_replace) like `${1}`, `${2}`, etc., to define dynamic targets.
2222

23-
- **Status code**: The HTTP status code of the redirect response (_301_ by default). Must be one of the following: _301_ (Moved permanently), _302_ (Found, also known as Moved temporarily), _307_ (Temporary redirect), or _308_ (Permanent redirect).
23+
- **Status code**: The HTTP status code of the redirect response (_301 - Permanent Redirect_ by default). Must be one of the following:
24+
25+
<Render file="redirects-status-codes" product="rules" />
2426

2527
- **Preserve query string**: Whether to preserve the query string when redirecting (disabled by default).
2628

@@ -32,7 +34,9 @@ A static URL redirect has the following configuration parameters:
3234

3335
- **URL**: A literal string that will be used in the `Location` HTTP header returned in the redirect response.
3436

35-
- **Status code**: The HTTP status code of the redirect response (_301_ by default). Must be one of the following: _301_ (Moved permanently), _302_ (Found, also known as Moved temporarily), _307_ (Temporary redirect), or _308_ (Permanent redirect).
37+
- **Status code**: The HTTP status code of the redirect response (_301 - Permanent Redirect_ by default). Must be one of the following:
38+
39+
<Render file="redirects-status-codes" product="rules" />
3640

3741
- **Preserve query string**: Whether to preserve the query string when redirecting (disabled by default).
3842

@@ -66,7 +70,9 @@ A dynamic URL redirect has the following configuration parameters:
6670

6771
- **Expression**: An [expression](/ruleset-engine/rules-language/expressions/) that defines the target URL of the redirect. The result of evaluating this expression will be used in the `Location` HTTP header returned in the redirect response. Refer to the [fields](/ruleset-engine/rules-language/fields/reference/) and [functions](/ruleset-engine/rules-language/functions/) you can use in expressions.
6872

69-
- **Status code**: The HTTP status code of the redirect response (_301_ by default). Must be one of the following: _301_ (Moved permanently), _302_ (Found, also known as Moved temporarily), _307_ (Temporary redirect), or _308_ (Permanent redirect).
73+
- **Status code**: The HTTP status code of the redirect response (_301 - Permanent Redirect_ by default). Must be one of the following:
74+
75+
<Render file="redirects-status-codes" product="rules" />
7076

7177
- **Preserve query string**: Whether to preserve the query string when redirecting (disabled by default).
7278

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
{}
3+
---
4+
5+
- **301 - Permanent Redirect**: The page has permanently moved to a new address. For `POST` requests, the client or browser might switch the HTTP method to `GET` when following the redirect.
6+
- **302 - Temporary Redirect**: The page has temporarily moved to a new address. For `POST` requests, the client or browser might switch the HTTP method to `GET` when following the redirect.
7+
- **307 - Advanced: Temporary, HTTP method preserved**: The page has temporarily moved to a new address. The client or browser must preserve the original HTTP method (for example, `POST`) when following the redirect.
8+
- **308 - Advanced: Permanent, HTTP method preserved**: The page has permanently moved to a new address. The client or browser must preserve the original HTTP method (for example, `POST`) when following the redirect.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22
{}
3-
43
---
54

65
The optional parameters can have the following values:
76

8-
* `"status_code"` (integer): `301` (Moved permanently), `302` (Found, also known as Moved temporarily), `307` (Temporary redirect), or `308` (Permanent redirect).
9-
* `"preserve_query_string"` (boolean): `true` or `false`.
7+
- `"status_code"` (integer):
8+
- `301` (permanent redirect)
9+
- `302` (temporary redirect)
10+
- `307` (temporary redirect, preserving original HTTP method)
11+
- `308` (permanent redirect, preserving original HTTP method)
12+
- `"preserve_query_string"` (boolean): `true` or `false`

0 commit comments

Comments
 (0)