Repository navigation
fix(client, openapi): follow redirects by default in fetch transport - #2425
Conversation
Stop forcing `redirect: 'manual'` in `FetchLinkTransport`, so `fetch` keeps its default behavior and follows redirects. Document on `OpenAPILink` that redirect responses are not reflected by default, and that overriding `fetch` with `redirect: 'manual'` receives them in server runtimes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7SxRQUQzZ994Tqbo5a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7SxRQUQzZ994Tqbo5a
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-lock
@orpc/mcp
@orpc/msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
-
Redirect default in the shared transport —
FetchLinkTransportno longer setsredirect: 'manual', so bothRPCLinkandOpenAPILinkinheritfetch's default of following redirects. -
Opaque redirect guard — the browser-only
opaqueredirectrejection stays for customfetchimplementations, reworded to name the cause. -
Tests —
rpc-link.test.tsdrops theredirect: 'manual'request assertions, whileopenapi-link.test.tsadds the default-config case (initcarries noredirect,Request.redirectisfollow) and aredirect: 'manual'custom-fetch case that returns a307detailed output. -
Docs and JSDoc — a new
## Redirect Responsessection inopenapi/link.mdx, the retargeted warning inopenapi/input-and-output-mapping.mdx, and a@remarksnote with an anchor onOpenAPILink.
ℹ️ The opt-in redirect: 'manual' path still decodes a 3xx as success on the RPC link
Nothing here is wrong with this PR — the default path that used to reach this code is gone. Flagging for follow-up on #2421: RPCLinkCodec still treats status < 400 as success, so a caller who copies the new docs' redirect: 'manual' fetch override onto RPCLink again gets the 3xx as the procedure output, which is the silent undefined outcome the issue describes.
Technical details
# 3xx remains decodable as RPC output when redirects are manually disabled
## Affected sites
- `packages/client/src/adapters/standard/rpc-link-codec.ts:149` — `const isOk = response.status < 400`, so any `3xx` that reaches the codec is decoded as `{ kind: 'output' }`.
- `apps/content/docs/openapi/link.mdx:291-302` — the documented `redirect: 'manual'` override is transport-level, so it applies to every `FetchLinkTransport` consumer, `RPCLink` included.
## Required outcome
- Decide whether the redirect half of #2421 is closed only for the default path (current state) or also for the opt-in one. If the latter, treat `3xx` as non-success in `RPCLinkCodec` with a message mirroring the `opaqueredirect` one.
## Open questions for the human (optional)
- Is a first-class `redirect` option on `FetchLinkTransportOptions` preferable to the custom-`fetch` workaround? Not required for this fix, and the docs workaround is sufficient today.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
orpc | 5bee438 | Commit Preview URL Branch Preview URL |
Nov 05 2026, 02:03 PM |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7SxRQUQzZ994Tqbo5a
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the previous Pullfrog review (6a6a614): documentation only, one new section in the v1 migration guide.
- Migrating from v1: fetch links follow redirects — documents that
RPCLinkandOpenAPILinkno longer forceredirect: 'manual', shows the customfetchoverride that restores the old3xx-as-output behavior, and links to the OpenAPI Link redirect section.
The "as in v1" claim checks out: @orpc/client@1.16.1's fetch adapter set redirect: 'manual', and v1's OpenAPILink delegates to that same client. The new #redirect-responses anchor resolves under pnpm docs:validate (blume --strict), and no other docs page still describes the old manual behavior.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
… beta.49 oRPC's fetch transport no longer sets redirect: "manual" (middleapi/orpc#2425), so the link's check for a 3xx answer can no longer fire.

Related to #2421 (the redirect part; the empty-body part is not covered here).
Changes
FetchLinkTransportno longer forcesredirect: 'manual', sofetchkeeps its default and follows redirects. A proxy redirect no longer resolves as the procedure output.fetchthat setsredirect: 'manual'in browsers. Its message is clearer.OpenAPILinkdocs and JSDoc warn that3xxresponses are not returned by default, and show how to get them with a customfetchusingredirect: 'manual'(server runtimes only).redirect: 'manual').Behavior change
3xxused to be returned as the output; it is now followed. Useredirect: 'manual'to keep the old behavior.Tests
redirect, so the request follows redirects.fetchusingredirect: 'manual', a307detailed-output procedure resolves to{ status: 307, headers: { location }, body: undefined }.pnpm check,pnpm docs:validateandpnpm testpass.🤖 Generated with Claude Code
https://claude.ai/code/session_01VVaw7SxRQUQzZ994Tqbo5a