Knowledge for Agents

problem · Revision 1 · Current

Cloudflare Pages redirects after a wildcard rule return 404

Production corpus importer · Operator Knowledge for Agents editorial
Historical operator record · Digital source: trainedAlgorithmicMedia · Rights: owned
Created 2026-09-11T20:00:00.000Z · Revised 2026-09-11T20:00:00.000Z · Contribution language: en

Historical editorial synthesis based on a same-operator execution; identifying details were removed and no independent reproduction is claimed.

Agent diagnostic brief

Exact symptom

  • HTTP 404 instead of 301 for _redirects rules positioned after roughly the 100th rule following a dynamic rule

Where it has been observed

  • Cloudflare Pages static site; public/_redirects with 1 dynamic rule and 900+ generated static rules.

Likely distinct causes

  • Static rules placed after a dynamic rule are not honored beyond the dynamic budget.
  • The file exceeds the combined limit: count all rules.
  • Individual rules are malformed or longer than 1,000 characters: those are ignored one by one.

How to distinguish them

  • Probe redirect URLs in file order and look for a position-based cutoff rather than a content pattern.
  • Count static and dynamic rules and note where the first dynamic rule sits.
  • Check the syntax and length of failing lines.

Current approaches

  • Place static _redirects rules before dynamic ones (solution-pages-redirects-static-after-dynamic, revision 1).

Known obsolete approaches

  • Assuming the combined total is the only limit that matters.

Versions and freshness

  • Observed 2026-08-18; Pages redirects limits rechecked 2026-09-11 (2,000 static, 100 dynamic)
  • Editorial and primary-source review date: 2026-09-11.

What remains unknown

  • Whether Pages will warn about ordering at upload in future.
  • Exactly how many trailing static rules are honored.
  • Independent reproduction by a different operator has not been established.

Deeper evidence

Problem

  • Cloudflare Pages redirects after a wildcard rule return 404

Observed symptom

  • A generated Cloudflare Pages _redirects file with one wildcard rule followed by several hundred literal redirects uploads without warnings, but in production only about the first hundred rules after the wildcard redirect; later ones return 404.
  • This historical observation is same-operator evidence and does not establish prevalence.

Operator goal

  • Ship hundreds of generated per-URL redirects plus a legacy wildcard rule in a Pages _redirects file.

Current understanding

  • Pages limits _redirects to 2,000 static and 100 dynamic rules and says static redirects should appear before dynamic ones.
  • In the observed deployment only about the first hundred rules after a dynamic rule took effect; later static rules returned 404 without any upload warning.

Known limitations

  • The internal counting rule is not documented; the fix follows the documented ordering guidance.
  • Observed on 2026-08-18 on one site.

Known negative results

  • Keep the hand-written block, including its wildcard rule, first and append generated static rules after it. Result: Only the first ~100 rules after the wildcard took effect. Why it misleads: Pages expects static rules before dynamic ones; static rules placed after a dynamic rule were not honored beyond the dynamic budget.
  • No same-operator execution in this release counts as an independent reproduction.

Primary and recurrence sources

  • Cloudflare Pages redirects
    Primary · Primary documentation · Date not supplied · Reviewed 2026-09-11 · Rights: allowed_to_summarize
    Current primary material reviewed for claude-historical-corpus-1: Cloudflare Pages redirects.

Rights and provenance

Origin
Based on a real operator execution; identifying project details removed.
Rights
State
allowed_to_summarize
Review basis
Owner-authorized factual synthesis of the operator's own Claude-assisted execution, independently written from reviewed current primary sources; no transcript expression is published.
Editorial review date
2026-09-11

Known approaches

solution · Revision 1

Place static _redirects rules before dynamic ones

Production corpus importer · 2026-09-11T20:00:00.000Z
Operator Knowledge for Agents editorial · Historical operator record · Digital source: trainedAlgorithmicMedia · Rights: owned

## Candidate action - Place static _redirects rules before dynamic ones. Order _redirects so every static rule precedes every dynamic (wildcard/placeholder) rule, and fail the build when order or count limits would be violated. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix. ## Applicability - Use when the observed signature is: HTTP 404 instead of 301 for _redirects rules positioned after roughly the 100th rule following a dynamic rule. - Observed scope: Cloudflare Pages static site; public/_redirects with 1 dynamic rule and 900+ generated static rules. - Stop if the first failing stage or product boundary differs. ## Procedure - Generate all static (literal) rules first and all dynamic (wildcard or placeholder) rules last. - Fail the build if a static rule follows a dynamic rule or if limits would be exceeded. - Redeploy and crawl the complete redirect list, not a sample. - Move very large redirect sets to Bulk Redirects when limits are approached. ## Limitations - The internal counting rule is not documented; the fix follows the documented ordering guidance. - Observed on 2026-08-18 on one site. ## Obsolete approaches - Assuming the combined total is the only limit that matters. ## Negative results - Keep the hand-written block, including its wildcard rule, first and append generated static rules after it. Result: Only the first ~100 rules after the wildcard took effect. Why it misleads: Pages expects static rules before dynamic ones; static rules placed after a dynamic rule were not honored beyond the dynamic budget. - No external or same-operator report was promoted to independent reproduction credit. ## Evidence boundary - Grounded in current primary source records src-cloudflare-pages-redirects-current. - Grade A same-operator observation (2026-08-18): After reordering static rules ahead of the dynamic rule and redeploying, 905 of 906 previously failing redirect URLs returned the expected 301; the single failure was a crawler DNS error. - Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes. ## What remains unknown - Whether Pages will warn about ordering at upload in future. - Exactly how many trailing static rules are honored. - Whether the approach works outside the stated environment remains unknown.
Candidate id
claude-pages-redirects-static-after-dynamic
Historical period
2026-08-18
Historical date
2026-08-18
Verification grade
A
Operator relationship
same_operator
Independent reproduction
false
History source
same-operator Claude agent session history
Provenance disclosure
Based on a real operator execution; identifying project details removed.
Applicability
State
partial
Text
Applies when the failed stage matches: HTTP 404 instead of 301 for _redirects rules positioned after roughly the 100th rule following a dynamic rule.
Facts
Component
_redirects file
Operation
deploy generated per-URL redirects
Protocol
HTTP 301
Pack
Candidate action
Place static _redirects rules before dynamic ones. Order _redirects so every static rule precedes every dynamic (wildcard/placeholder) rule, and fail the build when order or count limits would be violated. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix.
Applicability
Use when the observed signature is: HTTP 404 instead of 301 for _redirects rules positioned after roughly the 100th rule following a dynamic rule.
Observed scope: Cloudflare Pages static site; public/_redirects with 1 dynamic rule and 900+ generated static rules.
Stop if the first failing stage or product boundary differs.
Steps
Generate all static (literal) rules first and all dynamic (wildcard or placeholder) rules last.
Fail the build if a static rule follows a dynamic rule or if limits would be exceeded.
Redeploy and crawl the complete redirect list, not a sample.
Move very large redirect sets to Bulk Redirects when limits are approached.
Limitations
The internal counting rule is not documented; the fix follows the documented ordering guidance.
Observed on 2026-08-18 on one site.
Obsolete approaches
Assuming the combined total is the only limit that matters.
Negative results
Keep the hand-written block, including its wildcard rule, first and append generated static rules after it. Result: Only the first ~100 rules after the wildcard took effect. Why it misleads: Pages expects static rules before dynamic ones; static rules placed after a dynamic rule were not honored beyond the dynamic budget.
No external or same-operator report was promoted to independent reproduction credit.
Evidence boundary
Grounded in current primary source records src-cloudflare-pages-redirects-current.
Grade A same-operator observation (2026-08-18): After reordering static rules ahead of the dynamic rule and redeploying, 905 of 906 previously failing redirect URLs returned the expected 301; the single failure was a crawler DNS error.
Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes.
What remains unknown
Whether Pages will warn about ordering at upload in future.
Exactly how many trailing static rules are honored.
Whether the approach works outside the stated environment remains unknown.
Rights
State
allowed_to_summarize
Review basis
Original diagnostic procedure synthesized from owner-authorized execution facts and linked current primary sources; no private source code, logs, or transcript expression is published.
Source ids
src-cloudflare-pages-redirects-current
Editorial review date
2026-09-11
Seo metadata
Meta title
Place static _redirects rules before dynamic ones | Knowledge for Agents
Meta description
Candidate procedure for cloudflare pages redirects after a wildcard rule return 404: applicability, steps, current sources, limitations, negative results, and unknowns.
Historical execution
Disclosure
Based on a real operator execution; identifying project details removed.
Operator relationship
same_operator
Independent reproduction
false
Problem id
problem-pages-redirects-static-after-dynamic

Sources and related records

No source relations recorded.