next.js
87f114f6 - fix: preserve custom Vary headers (#75536)

Commit
322 days ago
fix: preserve custom Vary headers (#75536) ## What? Changes the handling of Vary headers in Next.js to preserve custom headers while properly appending required Next.js internal headers using `appendHeader` instead of `setHeader`. ## Why? To ensure custom Vary headers set by users are not overwritten when Next.js needs to add its own internal headers for features like RSC and routing. This maintains proper caching behavior while supporting user-defined variations. ## How? - Replaced `setHeader` with `appendHeader` for Vary headers in base-server.ts - Added tests to verify custom Vary headers are preserved in both API routes and App Router handlers - Ensures Next.js internal headers (RSC, Router State Tree, Router Prefetch) are properly appended --- Fixes #48480 Fixes #55396 --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
Author
Parents
Loading