-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Copy link
Labels
internalRequires support from the Cloudflare PlatformRequires support from the Cloudflare Platform
Description
What versions & operating system are you using?
System:
OS: macOS 26.1
CPU: (10) arm64 Apple M4
Memory: 516.30 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 25.1.0 - /opt/homebrew/bin/node
npm: 11.6.2 - /opt/homebrew/bin/npm
npmPackages:
wrangler: ^4.54.0 => 4.57.0
Please provide a link to a minimal reproduction
https://github.com/Bi11/bug-report-infinite-loop.git
Describe the Bug
Wrangler incorrectly flags a valid _redirects rule / /index.html 200 as an "Infinite loop", blocking deployment.
Why this is a bug
- No Implicit Loop: According to the HTML handling docs, when
html_handlingis set to"none", requesting/does not automatically serveindex.html(it results in a 404 or falls back tonot_found_handling). Therefore, explicitly rewriting/to/index.htmlis necessary logic, not a conflict. - Proxying is Non-Recursive: The rule uses status
200(Proxying). The Redirects docs explicitly state: "Only the first redirect in your will apply." Even if the paths were identical, the proxy logic stops after one hop. - Validation Logic Error: The error message claims the rule will "cause a redirect to strip .html". However, stripping
.htmlis a behavior ofauto-trailing-slashor standard handling. Sincehtml_handlingis set to"none", this stripping behavior is disabled, making the described loop impossible.
Reproduction
- Set
html_handling: "none"inwrangler.jsonc. - Add the rule
/ /index.html 200topublic/_redirects. - Run
npx wrangler pages devornpm run deploy.
Actual Behavior
npm run dev output:
Infinite loop detected in this rule and has been ignored. This will cause a redirect to strip .html or /index and end up triggering this rule again. Please fix or remove this rule to silence this warning.
at public/_redirects:1 | / /index.html 200
npm run deploy output:
Invalid _redirects configuration:
Line 1: Infinite loop detected in this rule. This would cause a redirect to
strip `.html` or `/index` and end up triggering this rule again. [code: 10021]
Workaround
I am migrating a legacy site that requires html_handling: "none". To bypass this validation error, I had to rename the index file to _index.html and update the rule to:
/ /_index.html 200
This confirms the platform supports the behavior, and the blockage is purely due to Wrangler's over-aggressive validation.
Please provide any relevant error logs
No response
AdamNatad
Metadata
Metadata
Assignees
Labels
internalRequires support from the Cloudflare PlatformRequires support from the Cloudflare Platform
Type
Projects
Status
Done