You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/rules/url-forwarding/bulk-redirects/how-it-works.mdx
+18-20Lines changed: 18 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ sidebar:
6
6
label: How it works
7
7
---
8
8
9
+
import { MetaInfo } from"~/components";
10
+
9
11
For each incoming request, Cloudflare evaluates all URL redirects of each Bulk Redirect List that is enabled by a Bulk Redirect Rule.
10
12
11
13
If there is a match for a URL redirect according to the URL matching algorithm, the redirect action is performed immediately, according to the URL redirect configuration parameters. Cloudflare performs no further processing once a redirect action has been executed.
@@ -14,27 +16,25 @@ If there is a match for a URL redirect according to the URL matching algorithm,
14
16
15
17
The following URL redirect parameters control the matching behavior between the request URL and source URLs of the configured (and enabled) URL redirects:
16
18
17
-
-**Subpath matching** (default: false)
18
-
19
-
- If true, the URL redirect will apply to all paths under the given source path. For example, consider the following source and target URLs of a URL redirect:
- If `true`, the URL redirect will apply to all paths under the given source path. For example, consider the following source and target URLs of a URL redirect:
22
22
23
-
— Target URL: `https://example.com/qux/`
23
+
- Source URL: `https://example.com/foo/`
24
+
- Target URL: `https://example.com/qux/`
24
25
25
26
- With this configuration and **Subpath matching** enabled, an incoming request to `example.com/foo/bar` will be redirected to `https://example.com/qux/bar`.
26
27
27
28
:::note
28
29
URL redirects with **Subpath matching** enabled cannot contain more than 16 `/` (slash) characters in the source URL path.
29
30
:::
30
31
31
-
-**Include subdomains** (default: false)
32
-
33
-
- If true, the source URL hostname of the URL redirect will also apply to all its subdomains. For example, consider the following source and target URLs of a URL redirect:
- If `true`, the source URL hostname of the URL redirect will also apply to all its subdomains. For example, consider the following source and target URLs of a URL redirect:
36
35
37
-
— Target URL: `https://example.com/newpage`
36
+
- Source URL: `https://example.com/about`
37
+
- Target URL: `https://example.com/newpage`
38
38
39
39
- With this configuration and **Includes subdomains** enabled, incoming requests to `http://a.example.com/about` and `http://a.b.example.com/about` would also match, in addition to the specified domain with no subdomain (`https://example.com/about`).
40
40
@@ -44,29 +44,27 @@ For detailed information on these parameters, refer to [URL redirect parameters]
44
44
45
45
The following parameters configure how Cloudflare determines the path and query string of the final target URL:
- If true, the final target URL will keep the query string of the original request. For example, consider the following source and target URLs of a URL redirect:
49
+
- If `true`, the final target URL will keep the query string of the original request. For example, consider the following source and target URLs of a URL redirect:
50
50
51
-
— Source URL: `https://example.com/about`
52
-
53
-
— Target URL: `https://example.com/newpage`
51
+
- Source URL: `https://example.com/about`
52
+
- Target URL: `https://example.com/newpage`
54
53
55
54
- With this configuration and **Preserve query string** enabled, an incoming request to `http://example.com/about?q=term` would be redirected to `https://example.com/newpage?q=term`. If **Preserve query string** is disabled, the same incoming request would be redirected to `https://example.com/newpage`.
- Defines if the final target URL will include the parts of the request path that did not match the URL redirect's source URL.
60
59
61
60
- When **Subpath matching** is enabled, the path that was not matched is copied over to the final target URL. For example, consider the following source and target URLs of a URL redirect:
62
61
63
-
— Source URL: `https://example.com/a/`
64
-
65
-
— Target URL: `https://example.com/b/`
62
+
- Source URL: `https://example.com/a/`
63
+
- Target URL: `https://example.com/b/`
66
64
67
65
- An incoming request to `https://example.com/a/foo` will be redirected to `https://example.com/b/foo`.
68
66
69
-
- If you set **Preserve path suffix** to false, the same request will still match the redirect, but it will be redirected to `https://example.com/b/`.
67
+
- If you set **Preserve path suffix** to `false`, the same request will still match the redirect, but it will be redirected to `https://example.com/b/`.
70
68
71
69
For detailed information on these parameters, refer to [URL redirect parameters](/rules/url-forwarding/bulk-redirects/reference/parameters/).
Copy file name to clipboardExpand all lines: src/content/docs/rules/url-forwarding/bulk-redirects/reference/parameters.mdx
+59-35Lines changed: 59 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,54 +5,78 @@ sidebar:
5
5
order: 3
6
6
---
7
7
8
+
import { Type, MetaInfo } from"~/components";
9
+
8
10
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.
9
11
10
-
The URL redirect parameters are the following:
12
+
## Source URL
13
+
14
+
API field: `source_url` <Typetext="String" />
15
+
16
+
The URL string that the incoming request URL must match for the redirect to be applied. This property is mandatory. The maximum length of the source URL is 32 KB.
17
+
18
+
The value must be a valid URL, but the URL scheme is not required (for example, `https`); when the scheme is omitted, the redirect applies to both `http` and `https` URL schemes.
19
+
20
+
A Bulk Redirect List cannot contain several URL redirects with the exact same source URL.
21
+
The exact behavior of the [URL matching algorithm](/rules/url-forwarding/bulk-redirects/how-it-works/#url-matching-algorithm), which matches an incoming request with the redirect's source URL, depends on the values of the [**Include subdomains**](#include-subdomains) and [**Subpath matching**](#subpath-matching) parameters.
22
+
23
+
For more information on the supported URL components, refer to [Supported URL components](/rules/url-forwarding/bulk-redirects/reference/url-components/).
24
+
25
+
## Target URL
26
+
27
+
API field: `target_url` <Typetext="String" />
28
+
29
+
The URL where the client will be redirected to when there is a match for the URL redirect. This property is mandatory. The maximum length of the target URL is 32 KB.
30
+
31
+
The value must be a valid URL. The final target URL depends on the values of the [**Preserve query string**](#preserve-query-string) and [**Preserve path suffix**](#preserve-path-suffix) parameters.
32
+
33
+
For more information on the supported URL components, refer to [Supported URL components](/rules/url-forwarding/bulk-redirects/reference/url-components/).
34
+
35
+
## Subpath matching
36
+
37
+
API field: `subpath_matching` <Typetext="Boolean" /> <MetaInfotext="default: false" />
38
+
39
+
If `true`, the current redirect will apply the subpath matching algorithm to the request URL when determining if there is a match for the current URL redirect.
40
+
41
+
For example, a URL redirect from `/my-folder/` to `/other-folder/` with **Subpath matching** enabled will also redirect a request from `/my-folder/item` to `/other-folder/item`. However, the redirect will only include the `item` part when [**Preserve path suffix**](#preserve-path-suffix) is `true`.
42
+
43
+
For more information, refer to [Matching the source URL of redirects](/rules/url-forwarding/bulk-redirects/how-it-works/#matching-the-source-url-of-redirects).
44
+
45
+
## Include subdomains
46
+
47
+
API field: `include_subdomains` <Typetext="Boolean" /> <MetaInfotext="default: false" />
48
+
49
+
If `true`, the source URL hostname will also apply to any subdomains — the redirect will match for all subdomains to the left of the domain portion of the source URL, as well as the specified domain.
50
+
51
+
For example, a redirect with source URL defined as `http://example.com/about` will also apply to requests with source URL `http://a.example.com/about` or `http://a.b.example.com/about`.
11
52
12
-
-**Source URL** (String)
53
+
For more information, refer to [Matching the source URL of redirects](/rules/url-forwarding/bulk-redirects/how-it-works/#matching-the-source-url-of-redirects).
13
54
14
-
- API field name: `source_url`.
15
-
- The URL string that the incoming request URL must match for the redirect to be applied. This property is mandatory. The maximum length of the source URL is 32 KB.
16
-
- The value must be a valid URL, but the URL scheme is not required (for example, `https`); when the scheme is omitted, the redirect applies to both `http` and `https` URL schemes.
17
-
- A Bulk Redirect List cannot contain several URL redirects with the exact same source URL.
18
-
- The exact behavior of the [URL matching algorithm](/rules/url-forwarding/bulk-redirects/how-it-works/#url-matching-algorithm), which matches an incoming request with the redirect’s source URL, depends on the values of the **Include subdomains** and **Subpath matching** parameters.
19
-
- For more information on the supported URL components, refer to [Supported URL components](/rules/url-forwarding/bulk-redirects/reference/url-components/).
55
+
## Preserve query string
20
56
21
-
-**Target URL** (String)
57
+
API field: `preserve_query_string` <Typetext="Boolean" /> <MetaInfotext="default: false" />
22
58
23
-
- API field name: `target_url`.
24
-
- The URL where the client will be redirected to when there is a match for the URL redirect. This property is mandatory. The maximum length of the target URL is 32 KB.
25
-
- The value must be a valid URL. The final target URL depends on the values of the **Preserve query string** and **Preserve path suffix** parameters.
26
-
- For more information on the supported URL components, refer to [Supported URL components](/rules/url-forwarding/bulk-redirects/reference/url-components/).
59
+
If `true`, the redirect URL will keep the query string of the original request.
27
60
28
-
-**Subpath matching**(Boolean)
61
+
For example, a URL redirect from `/my-folder/` to `/other-folder/` with **Preserve query string**enabled will redirect a request from `/my-folder/?name=value` to `/other-folder/?name=value`. If **Preserve query string** is disabled, the request will be redirected from `/my-folder/?name=value` to `/other-folder/`.
29
62
30
-
- API field name: `subpath_matching`.
31
-
- If true, the current redirect will apply the subpath matching algorithm to the request URL when determining if there is a match for the current URL redirect. The default value is `false`.
32
-
- For example, a URL redirect from `/my-folder/` to `/other-folder/` with **Subpath matching** enabled will also redirect a request from `/my-folder/item` to `/other-folder/item`. However, the redirect will only include the `item` part when **Preserve path suffix** is true. Refer to **Preserve path suffix** for details.
33
-
- For more information, refer to [Matching the source URL of redirects](/rules/url-forwarding/bulk-redirects/how-it-works/#matching-the-source-url-of-redirects).
63
+
## Preserve path suffix
34
64
35
-
-**Include subdomains** (Boolean)
65
+
API field: `preserve_path_suffix` <Typetext="Boolean" /> <MetaInfotext="default: true" />
36
66
37
-
- API field name: `include_subdomains`.
38
-
- If true, the source URL hostname will also apply to any subdomains — the redirect will match for all subdomains to the left of the domain portion of the source URL, as well as the specified domain. The default value is `false`.
39
-
- For example, a redirect with source URL defined as `http://example.com/about` will also apply to requests with source URL `http://a.example.com/about` or `http://a.b.example.com/about`.
40
-
- For more information, refer to [Matching the source URL of redirects](/rules/url-forwarding/bulk-redirects/how-it-works/#matching-the-source-url-of-redirects).
67
+
Applicable only when [**Subpath matching**](#subpath-matching) is enabled. If `true`, defines that the redirect URL will include the remaining (non-matched) path elements of the source URL, if any.
For example, when both **Subpath matching** and **Preserve path suffix** are enabled, a URL redirect from `/my-folder/` to `/another-folder/` will redirect an incoming request from `/my-folder/foo` to `/another-folder/foo`. If **Preserve path suffix**is disabled, the same request would still match the URL redirect, but it would redirect from `/my-folder/foo` to `/another-folder/`.
43
70
44
-
- API field name: `preserve_query_string`.
45
-
- If true, the redirect URL will keep the query string of the original request. The default value is `false`.
46
-
- For example, a URL redirect from `/my-folder/` to `/other-folder/` with **Preserve query string** enabled will redirect a request from `/my-folder/?name=value` to `/other-folder/?name=value`. If **Preserve query string** is disabled, the request will be redirected from `/my-folder/?name=value` to `/other-folder/`.
71
+
## Status code
47
72
48
-
-**Preserve path suffix** (Boolean)
73
+
API field: `status_code` <Typetext="Integer" /> <MetaInfotext="default: 301" />
49
74
50
-
- API field name: `preserve_path_suffix`.
51
-
- Applicable only when **Subpath matching** is enabled. If true, defines that the redirect URL will include the remaining (non-matched) path elements of the source URL, if any. The default value is `true`.
52
-
- For example, when both **Subpath matching** and **Preserve path suffix** are enabled, a URL redirect from `/my-folder/` to `/another-folder/` will redirect an incoming request from `/my-folder/foo` to `/another-folder/foo`. If **Preserve path suffix** is disabled, the same request would still match the URL redirect, but it would redirect from `/my-folder/foo` to `/another-folder/`.
75
+
The HTTP status code returned to the client when redirecting.
53
76
54
-
-**Status code** (Integer)
77
+
The value must be one of the following:
55
78
56
-
- API field name: `status_code`.
57
-
- The HTTP status code returned to the client when redirecting. The default value is `301`.
58
-
- The value must be one of the following: `301` (Moved permanently), `302` (Found, also known as Moved temporarily), `307` (Temporary redirect), or `308` (Permanent redirect).
0 commit comments