Skip to content

fix(dev): handle Chrome DevTools well-known request in framework mode - #15812

Open
Bhaskar-tech1 wants to merge 1 commit into
remix-run:mainfrom
Bhaskar-tech1:fix/15337-chromium-devtools-well-known
Open

Bhaskar-tech1 wants to merge 1 commit into
remix-run:mainfrom
Bhaskar-tech1:fix/15337-chromium-devtools-well-known

Conversation

@Bhaskar-tech1

Copy link
Copy Markdown

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:

Error: No route matches URL "/.well-known/appspecific/com.chrome.devtools.json"

This PR updates the @react-router/dev Vite plugin development server to quietly respond with 204 No Content and Cache-Control: no-store for this specific probing path in development mode when no static file is present in public/.

Root Cause

Chromium DevTools probes RFC 8615 well-known endpoints on localhost for optional DevTools custom configuration. When no static file exists in public/.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 to console.error.

Changes

  • packages/react-router-dev/vite/plugin.ts:
    • Added CHROMIUM_DEVTOOLS_WELL_KNOWN_PATH constant for /.well-known/appspecific/com.chrome.devtools.json.
    • Added isChromiumDevToolsWellKnownRequest to match GET and HEAD requests matching the target path (supporting raw URLs, query strings, and base-stripped originalUrl).
    • Added handleChromiumDevToolsWellKnownRequest to return 204 No Content with Cache-Control: no-store, while honoring any user-provided static file in public/ with 200 OK.
    • Mounted the middleware in 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:
    • Added 15 regression tests covering unit behavior, Vite dev server 204 handling, headers, normal route passthrough, 404 route miss preservation, static file precedence, and production behavior.
  • integration/vite-dev-test.ts:
    • Added an integration test to the Vite dev Playwright suite.
  • packages/react-router-dev/.changes/patch.handle-chrome-devtools-well-known.md:
    • Added patch changeset.

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.ts

Validation

  • pnpm test packages/react-router-dev/__tests__/chromium-devtools-well-known-test.ts -> Passed
  • pnpm run --filter @react-router/dev typecheck -> Passed
  • pnpm eslint packages/react-router-dev/vite/plugin.ts packages/react-router-dev/__tests__/chromium-devtools-well-known-test.ts integration/vite-dev-test.ts -> Passed
  • pnpm run changes:validate -> Passed
  • npx prettier --check ... -> Passed
  • pnpm run --filter @react-router/dev build -> Passed

Related Issue

Closes #15337

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chromium DevTools well-known request still logs noisy route miss in framework mode

1 participant