Skip to content

[wrangler] Surface _redirects validation warnings at deploy time (#14694)#14709

Open
allocsys wants to merge 13 commits into
cloudflare:mainfrom
allocsys:fix/14694-redirects-deploy-warning
Open

[wrangler] Surface _redirects validation warnings at deploy time (#14694)#14709
allocsys wants to merge 13 commits into
cloudflare:mainfrom
allocsys:fix/14694-redirects-deploy-warning

Conversation

@allocsys

@allocsys allocsys commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #14694

What this PR solves

Wrangler's deploy-time _redirects validation didn't respect assets.html_handling when checking for infinite-loop redirect rules. This caused a false "infinite loop" warning for setups like html_handling: "none" with a rule such as / /index.html, since the validator didn't account for HTML handling being disabled.

Fix

parseRedirects() in resolveAssetOptions() now passes htmlHandling: config.assets?.html_handling, matching the behavior already used by the Vite plugin (packages/vite-plugin-cloudflare/src/asset-config.ts).

Tests

  • Tests included/updated
    • html_handling: "none" + a rule like / /index.html no longer produces a false "infinite loop" warning at deploy time
    • The same rule with default HTML handling is still correctly flagged as an infinite loop, confirming detection isn't weakened

Documentation

  • Documentation not necessary because: this fixes a bug in existing validation logic; no new user-facing behavior or config surface is introduced

@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 16eb284

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
wrangler Patch
@cloudflare/workers-shared Patch
@cloudflare/deploy-helpers Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
@cloudflare/remote-bindings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@allocsys allocsys changed the title Surface _redirects validation warnings at wrangler deploy time (#14694) [wrangler] Surface _redirects validation warnings at deploy time (#14694) Jul 15, 2026
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/deploy-config
  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/warm-redirects-deploy-warning.md: [@cloudflare/wrangler]
  • packages/deploy-helpers/src/deploy/helpers/assets.ts: [@cloudflare/wrangler]
  • packages/workers-shared/utils/configuration/constructConfiguration.ts: [@cloudflare/deploy-config @cloudflare/wrangler]
  • packages/wrangler/src/tests/deploy/assets.test.ts: [@cloudflare/wrangler]

devin-ai-integration[bot]

This comment was marked as resolved.

allocsys added 2 commits July 16, 2026 00:26
…udflare#14694 review comment)

config.assets?.html_handling was already available in this function but wasn't threaded through to the new deploy-time parseRedirects() call, so htmlHandling defaulted to undefined -- which parseRedirects treats as "enabled" -- causing false "infinite loop detected" warnings for users who set html_handling: "none" on rules like `/ /index.html`. Now passes the same option the Vite plugin already passes correctly.
…infinite-loop warning at deploy time

Covers the review finding on cloudflare#14709 -- parseRedirects() previously ran with htmlHandling always undefined at deploy time (treated as enabled), so a rule like `/ /index.html` was flagged as an infinite loop even for projects that explicitly disabled HTML handling. Adds a test confirming no warning is produced now that config.assets?.html_handling is threaded through, plus a sanity check that the real infinite-loop case is still caught when HTML handling is left at its default.
@allocsys

Copy link
Copy Markdown
Contributor Author

Fixed in 018173cparseRedirects() in resolveAssetOptions() now passes htmlHandling: config.assets?.html_handling, matching what the Vite plugin already does at packages/vite-plugin-cloudflare/src/asset-config.ts.

Added two regression tests in 627a9d2:

  • html_handling: "none" + a rule like / /index.html no longer produces a false "infinite loop" warning at deploy time.
  • The same rule with HTML handling left at its default is still correctly flagged as an infinite loop, so the real detection isn't weakened.

Both commits are pushed to this PR's branch. Thanks for catching this!

Comment thread .changeset/warm-redirects-deploy-warning.md Outdated
Comment thread packages/wrangler/src/__tests__/deploy/assets.test.ts Outdated
Comment thread packages/wrangler/src/__tests__/deploy/assets.test.ts Outdated
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14709

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14709

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14709

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14709

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14709

miniflare

npm i https://pkg.pr.new/miniflare@14709

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14709

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14709

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14709

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14709

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14709

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14709

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14709

wrangler

npm i https://pkg.pr.new/wrangler@14709

commit: 16eb284

@NuroDev NuroDev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the PR description to reflect the repository template so we have details on tests, docs, etc.

@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk Jul 16, 2026
@allocsys

Copy link
Copy Markdown
Contributor Author

Thanks @NuroDev — addressed all three:

  • Removed the leftover <!-- trigger fork CI --> comment from .changeset/warm-redirects-deploy-warning.md (4ef9ffe).
  • Dropped the (#14694) and (#14709 review) issue references from the two test names in assets.test.ts (90ed703).

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

… appears in the wrangler changelog, per Devin review feedback on PR cloudflare#14709
@allocsys

Copy link
Copy Markdown
Contributor Author

Good catch — fixed in 175cf65. wrangler now bumped directly in the changeset so this gets a descriptive changelog entry instead of an opaque dependency-bump line.

@allocsys

Copy link
Copy Markdown
Contributor Author

@NuroDev The PR description now includes the Tests and Documentation sections from the template — could you take another look when you get a chance?

@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/deploy-config
  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/warm-redirects-deploy-warning.md: [@cloudflare/wrangler]
  • packages/deploy-helpers/src/deploy/helpers/assets.ts: [@cloudflare/wrangler]
  • packages/workers-shared/utils/configuration/constructConfiguration.ts: [@cloudflare/deploy-config @cloudflare/wrangler]
  • packages/wrangler/src/tests/deploy/assets.test.ts: [@cloudflare/wrangler]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

_redirects: dynamic-rule overflow silently drops rest of file; static/dynamic classification is order-dependent and unsurfaced

3 participants