Skip to content

fix: don't merge request query into c.redirect() destinations - #705

Merged
cpojer merged 2 commits into
voidzero-dev:mainfrom
0froq:fix/redirect-no-query-merge
Nov 4, 2026
Merged

cpojer merged 2 commits into
voidzero-dev:mainfrom
0froq:fix/redirect-no-query-merge

Conversation

@0froq

@0froq 0froq commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes #648

Description

Took proposal 1 from the issue. Config routing.redirects still merge the incoming request query into the destination. c.redirect() in handlers, loaders, and middleware sends exactly the location it is given, same idea as Next.js config redirects vs redirect() / NextResponse.redirect().

Named-action redirects keep the existing action-key / page-query behavior. Absolute and protocol-relative destinations are unchanged. Docs updated in docs/reference/api/rewrites.md and docs/guide/edge/redirects.md.

Test

  • vp test run packages/void/test/unit/routing-runtime.test.ts -t 'code redirects and routing.redirects'
  • vp test run packages/void/test/unit/routing-runtime.test.ts packages/void/test/unit/compile.test.ts
  • vp test related --run packages/void/src/runtime/routing.ts --project unit --project unit-pglite --project cli-unit
  • vp test run packages/void/test/integration/typed-routing-runtime.test.ts
  • vp run --filter ./packages/void typecheck

cursoragent and others added 2 commits November 4, 2026 10:13
Handler, loader, and middleware redirects no longer copy the request
query onto an internal path. routing.redirects still merge that query.
A named action still places its key and keeps the page query.

Co-authored-by: sayhola <sayhola@froq.me>
Config redirects still merge the request query into the destination.

Co-authored-by: sayhola <sayhola@froq.me>

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@cpojer
cpojer merged commit 8689af5 into voidzero-dev:main Nov 4, 2026
18 checks passed
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.

c.redirect() merges the request's query into same-site paths, with no opt-out

3 participants