mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #277] [MERGED] fix: stop stripping credential headers from rewrite proxy requests #436
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#436
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?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/277
Author: @17hz
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/7/2026
Merged by: @southpolesteve
Base:
main← Head:fix/preserve-credentials-proxy📝 Commits (2)
f01de62fix: stop stripping credential headers from rewrite proxy requestsae52c07test: update proxy tests to assert credential headers are forwarded📊 Changes
4 files changed (+13 additions, -24 deletions)
View changed files
📝
packages/vinext/src/config/config-matchers.ts(+0 -6)📝
packages/vinext/src/server/app-dev-server.ts(+0 -6)📝
tests/app-router.test.ts(+6 -6)📝
tests/shims.test.ts(+7 -6)📄 Description
Fixes #264
Problem
proxyExternalRequestand__proxyExternalRequestunconditionally stripcookie,authorization,x-api-key, andproxy-authorizationheaders from all proxied rewrite requests. This breaks authentication for the most common use case — proxying to the user's own backend.Context
Next.js does not strip these headers for rewrites. It forwards all request headers as-is to the rewrite destination. vinext's blanket stripping is a deviation from Next.js behavior that breaks real-world usage.
Fix
Remove the credential-stripping logic from both:
config-matchers.ts—proxyExternalRequest(used by prod server)app-dev-server.ts—__proxyExternalRequest(inlined in dev server virtual module)Internal
x-middleware-*headers are still stripped as before.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.