Skip to content

Add support for future.unstable_passThroughRequests#14775

Merged
brophdawg11 merged 15 commits into
devfrom
brophdawg11/passthrough-requests
Feb 27, 2026
Merged

Add support for future.unstable_passThroughRequests#14775
brophdawg11 merged 15 commits into
devfrom
brophdawg11/passthrough-requests

Conversation

@brophdawg11
Copy link
Copy Markdown
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. This also removes the ability to differentiate document from data requests, which makes instrumentation more difficult.

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

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

// Submission requests are impacted if you performed a document request 
// submission to an index route, because the ?index param will no longer be 
// stripped from the `request.url`.
// Assume POST /a/b/c?index
export function loader({ request, unstable_url }) {
  // previous request -> POST https://example.com/a/b/c
  //      new request -> POST https://example.com/a/b/c?index
  //     unstable_url -> https://example.com/a/b/c
}

// Data requests are also impacted, because the .data suffix will no longer 
// be stripped from `request.url`
// Assume user navigated to /a/b/c?k=v in their browser
export function loader({ request, unstable_url }) {
  // previous request -> GET https://example.com/a/b/c?k=v
  //      new request -> GET https://example.com/a/b/c.data?k=v
  //     unstable_url -> https://example.com/a/b/c?k=v
}

// Granular revalidation data requests will also no longer have the `_routes` 
// param stripped from the `request.url`
export function loader({ request, unstable_url }) {
  // 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_url -> https://example.com/a/b/c?k=v
}

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: 8b16aca

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
Copy Markdown
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

@brophdawg11 brophdawg11 marked this pull request as ready for review February 24, 2026 22:06
@brophdawg11 brophdawg11 merged commit d827bb9 into dev Feb 27, 2026
12 of 13 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/passthrough-requests branch February 27, 2026 17:00
timdorr pushed a commit to kuzznicki/react-router that referenced this pull request Mar 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version 7.13.2-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version 7.13.2 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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.

stripIndexParam&stripRoutesParam pattern is triggering a bug in undici causing AbortSignal to be skipped

1 participant