mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #265] [CLOSED] fix: strip content-encoding/content-length from proxied rewrite responses #427
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#427
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/265
Author: @17hz
Created: 3/5/2026
Status: ❌ Closed
Base:
main← Head:fix/content-encoding-proxy📝 Commits (1)
eefc283fix: strip content-encoding/content-length from proxied rewrite responses📊 Changes
2 files changed (+7 additions, -2 deletions)
View changed files
📝
packages/vinext/src/config/config-matchers.ts(+6 -1)📝
packages/vinext/src/server/app-dev-server.ts(+1 -1)📄 Description
Fixes #263
Problem
proxyExternalRequestand__proxyExternalRequestforward upstreamcontent-encodingandcontent-lengthheaders to the browser as-is. However, Node.jsfetch()automatically decompresses response bodies (gzip, br, deflate), so these headers no longer match the actual body. The browser seescontent-encoding: gzip, attempts to decompress the already-decompressed body, and fails withERR_CONTENT_DECODING_FAILED.Fix
Strip
content-encodingandcontent-lengthfrom upstream response headers before forwarding to the client. Applied in both:config-matchers.ts—proxyExternalRequest(used by prod server)app-dev-server.ts—__proxyExternalRequest(inlined in dev server virtual module)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.