Repository navigation
fix(dev): handle Chrome DevTools well-known request in framework mode - #15812
Open
Bhaskar-tech1 wants to merge 1 commit into
Open
Bhaskar-tech1 wants to merge 1 commit into
Bhaskar-tech1 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When opening a local React Router Framework Mode application in a Chromium-based browser (Chrome, Chromium, Edge) with DevTools open, the browser automatically sends a probing request to
/.well-known/appspecific/com.chrome.devtools.json.Because this browser-generated request does not match any application route, the dev server currently falls through to SSR route matching, which logs a noisy route-miss error in the terminal:
This PR updates the
@react-router/devVite plugin development server to quietly respond with204 No ContentandCache-Control: no-storefor this specific probing path in development mode when no static file is present inpublic/.Root Cause
Chromium DevTools probes RFC 8615 well-known endpoints on
localhostfor optional DevTools custom configuration. When no static file exists inpublic/.well-known/appspecific/com.chrome.devtools.json, the request falls through Vite's internal static file middleware and is intercepted by React Router's SSR request handler. Because the path is not a declared application route, React Router throws an unhandled route miss error and logs it toconsole.error.Changes
packages/react-router-dev/vite/plugin.ts:CHROMIUM_DEVTOOLS_WELL_KNOWN_PATHconstant for/.well-known/appspecific/com.chrome.devtools.json.isChromiumDevToolsWellKnownRequestto matchGETandHEADrequests matching the target path (supporting raw URLs, query strings, and base-strippedoriginalUrl).handleChromiumDevToolsWellKnownRequestto return204 No ContentwithCache-Control: no-store, while honoring any user-provided static file inpublic/with200 OK.configureServer's returned post-hook so it executes after Vite's static asset middleware and before React Router's SSR route matching.packages/react-router-dev/__tests__/chromium-devtools-well-known-test.ts:integration/vite-dev-test.ts:packages/react-router-dev/.changes/patch.handle-chrome-devtools-well-known.md:Tests
packages/react-router-dev/__tests__/chromium-devtools-well-known-test.ts(15/15 tests passing)packages/react-router-dev/vite/(all 6 test suites, 145/145 tests passing)integration/vite-dev-test.tsValidation
pnpm test packages/react-router-dev/__tests__/chromium-devtools-well-known-test.ts-> Passedpnpm run --filter @react-router/dev typecheck-> Passedpnpm eslint packages/react-router-dev/vite/plugin.ts packages/react-router-dev/__tests__/chromium-devtools-well-known-test.ts integration/vite-dev-test.ts-> Passedpnpm run changes:validate-> Passednpx prettier --check ...-> Passedpnpm run --filter @react-router/dev build-> PassedRelated Issue
Closes #15337