Skip to content

Add support for future.unstable_passThroughRequests#14775

Draft
brophdawg11 wants to merge 6 commits intodevfrom
brophdawg11/passthrough-requests
Draft

Add support for future.unstable_passThroughRequests#14775
brophdawg11 wants to merge 6 commits intodevfrom
brophdawg11/passthrough-requests

Conversation

@brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Feb 4, 2026

RFC: #14505

This is a standalone RFC, but it's being driven by the Observability RFC because it will allow users to differentiate document from data requests in their instrumentation layers.

Currently, we strip .data suffixes, ?index search params and ?_routes search params from the request.url passed to loaders, actions, middleware. This means we incur some minor overhead to create a few new Request instances during server side processing.

With this new future flag, we will stop altering the request and pass it to you as-is. To preserve the "location the application is at" (what the mutated request.url represents today), we're adding a sibling unstable_path parameter.

// GET Document requests aren't impacted
// Assume user loaded /a/b/c?k=v in their browser
export function loader({ request, unstable_path }) {
  // previous request -> GET https://example.com/a/b/c?k=v
  // new request -> GET https://example.com/a/b/c?k=v
  // new unstable_path = { pathname: "/a/b/c", search: "?k=v", hash: "" }  
}

// Submission requests are if you performed a document request submission to an index route
// Assume POST /a/b/c?index
export function loader({ request, unstable_path }) {
  // previous request -> POST https://example.com/a/b/c
  // new request -> POST https://example.com/a/b/c?index
  // new unstable_path = { pathname: "/a/b/c", search: "", hash: "" }  
}

// Data requests are also impacted
// Assume user navigated to /a/b/c?k=v in their browser
export function loader({ request, unstable_path }) {
  // previous request -> GET https://example.com/a/b/c?k=v
  // new request -> GET https://example.com/a/b/c.data?k=v
  // unstable_path = { pathname: "/a/b/c", search: "?k=v", hash: "" }  
}

// Data requests are also impacted
// Or is doing granular revalidation and only revalidating the root route with _routes=root
export function loader({ request, unstable_path }) {
  // previous request -> GET https://example.com/a/b/c?k=v
  // new request -> GET https://example.com/a/b/c.data?k=v&_routes=root
  // unstable_path = { pathname: "/a/b/c", search: "?k=v", hash: "" }  
}

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: 3d17cf5

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

This PR includes changesets to release 11 packages
Name Type
@react-router/dev Patch
react-router Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
@react-router/architect Patch
@react-router/cloudflare Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
create-react-router 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

@brophdawg11 brophdawg11 force-pushed the brophdawg11/passthrough-requests branch from 229d623 to d0bf942 Compare February 5, 2026 14:53
unstable_instrumentations,
mapRouteProperties,
future: {
middleware: ssrInfo.context.future.v8_middleware,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no client-side middleware future flag since it was an opt-in API, so this wasn't doing anything

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant