Skip to content

feat(local-explorer-ui): Fix index route path matching - #12864

Merged
NuroDev merged 10 commits into
mainfrom
NuroDev/fix-local-explorer-path-matching
Mar 12, 2026
Merged

feat(local-explorer-ui): Fix index route path matching#12864
NuroDev merged 10 commits into
mainfrom
NuroDev/fix-local-explorer-path-matching

Conversation

@NuroDev

@NuroDev NuroDev commented Mar 12, 2026

Copy link
Copy Markdown
Member

Fixes N/A.

Changes

  • Updates the Local Explorer Miniflare Worker to properly account for /cdn-cgi/explorer without a trailing slash.
  • Fixes the sidebare header link to redirect to /cdn-cgi/explorer/ instead of /
    • This is fine for developing LE with Vite where there's a base URL, but in production use it will redirect to / of the user worker.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Internal bug fix

A picture of a cute animal (not mandatory, but encouraged)


Open with Devin

@NuroDev NuroDev self-assigned this Mar 12, 2026
@changeset-bot

changeset-bot Bot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aecf922

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

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

@github-actions

github-actions Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

I've thoroughly reviewed all the changes. Let me summarize my findings:

  1. entry.worker.ts: The old code used url.pathname.startsWith(LOCAL_EXPLORER_BASE_PATH) which would match /cdn-cgi/explorerfoo as well as /cdn-cgi/explorer. The fix correctly splits this into an exact match (=== LOCAL_EXPLORER_BASE_PATH) and a prefix match with trailing slash (startsWith(\${LOCAL_EXPLORER_BASE_PATH}/`)`). This is a proper path-matching pattern.

  2. Sidebar.tsx: The href change from / to /cdn-cgi/explorer/ is correct -- in production (served through the Miniflare worker), / would route to the user's worker, not the explorer.

  3. Tests: Three new routing tests cover the exact scenarios: without trailing slash, with trailing slash, and the prefix-collision case (/cdn-cgi/explorerfoo). All appropriate.

  4. Changesets: Two separate changesets for the two affected packages -- correct per repo guidelines.

The logic is sound, the tests cover the important edge cases, and the fix is minimal and targeted.

LGTM

github run

@NuroDev
NuroDev marked this pull request as ready for review March 12, 2026 11:33
@NuroDev
NuroDev requested a review from a team as a code owner March 12, 2026 11:33
@workers-devprod

workers-devprod commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Mar 12, 2026

Copy link
Copy Markdown
create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 6a757e8

Comment thread .changeset/rude-steaks-kick.md Outdated
Comment thread .changeset/brave-mails-take.md Outdated
Comment thread packages/miniflare/test/plugins/local-explorer/index.spec.ts Outdated
@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Mar 12, 2026
@NuroDev
NuroDev merged commit ecc7f79 into main Mar 12, 2026
48 of 51 checks passed
@NuroDev
NuroDev deleted the NuroDev/fix-local-explorer-path-matching branch March 12, 2026 13:40
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants