Skip to content

Commit f16a430

Browse files
committed
[Workers] Document _redirects static/dynamic ordering behaviour
1 parent 9a74854 commit f16a430

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/content/partials/workers/redirects.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,23 @@ Lines starting with a `#` will be treated as comments.
4848

4949
A `_redirects` file is limited to 2,000 static redirects and 100 dynamic redirects, for a combined total of 2,100 redirects. Each redirect declaration has a 1,000-character limit.
5050

51+
A redirect is counted as **dynamic** if its `source` contains a [splat (`*`)](#splats) or a [placeholder (`:name`)](#placeholders). Any other redirect is **static**.
52+
5153
In your `_redirects` file:
5254

5355
- The order of your redirects matter. If there are multiple redirects for the same `source` path, the top-most redirect is applied.
54-
- Static redirects should appear before dynamic redirects.
56+
- Static redirects must appear before any dynamic redirect. Redirects are counted as static only until the first dynamic redirect is reached. After that point, every remaining redirect — including exact-path ones that would otherwise be static — counts towards the 100 dynamic redirect limit.
57+
- At runtime, static redirects are matched before dynamic redirects, regardless of their position in the file.
5558
- Redirects are always followed, regardless of whether or not an asset matches the incoming request.
5659

60+
:::caution[Redirect ordering affects how limits are counted]
61+
62+
Because redirects stop being counted as static after the first dynamic redirect, placing dynamic redirects early in the file reduces how many static redirects you can define. If the number of dynamic redirects exceeds 100, the rest of the file is skipped and those redirects are silently dropped from the deployment — including any catch-all redirect at the end of the file.
63+
64+
To use the full 2,000 static redirect limit, define all static redirects before your first dynamic redirect.
65+
66+
:::
67+
5768
A complete example with multiple redirects may look like the following:
5869

5970
```txt

0 commit comments

Comments
 (0)