mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #264] Bug: Rewrite proxy strips cookie/authorization headers, breaking backend auth #69
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#69
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @17hz on GitHub (Mar 5, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/264
Description
proxyExternalRequest(inconfig-matchers.ts) and__proxyExternalRequest(inlined inapp-dev-server.ts) unconditionally stripcookie,authorization,x-api-key, andproxy-authorizationheaders from proxied rewrite requests. This breaks authentication for users who userewritesto proxy to their own backend services.Root Cause
The proxy functions contain:
This was added as a security measure to prevent credential leakage to third-party origins. However, the most common use case for rewrites is proxying to the user's own backend, where these credentials are required.
Reproduction
Any authenticated request to
/api/...will fail because theauthorizationheader and cookies are stripped before reaching the backend.Expected Behavior
Next.js itself does not strip these headers for rewrite proxies — it forwards all headers as-is to the destination. vinext should match this behavior for compatibility.
Suggested Fix
Remove the blanket credential stripping. If security hardening is desired for third-party origins, consider:
Environment