-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
What version of Bun is running?
1.2.14
What platform is your computer?
Tested on both Darwin 24.3.0 x86_64 i386 and Linux 5.14.0-427.13.1.el9_4.x86_64 x86_64 x86_64
What steps can reproduce the bug?
- Create a NextJS project.
- Configure next
rewritesand proxy a test url (e.g./blog) to a URL that already generatestransfer-encoding: chunked(e.g. A WordPress site).
My config is as below
rewrites: async() => {
return {
beforeFiles: [
{
source: '/blog',
destination: 'http://X.X.X.X:8080/blog/', /* WordPress enforces trailing slash */
},
{
source: '/blog/:path*',
destination: 'http://X.X.X.X:8080/blog/:path*/',
}
],
};
},
- Make a request to your proxied URL (
/blog).
What is the expected behavior?
No duplicate transfer-encoding or any other headers must be set just like how bun run start is doing it.
What do you see instead?
Accessing the /blog URL in the given steps above, you'd see that duplicate transfer-encoding and date response headers are sent back to the browser.
The duplicate date flag is no problem but duplicate transfer-encoding headers are prohibited and non-standard. Services like CloudFlare do not skip this duplication and raise errors.
Additional information
The workaround is obviously using bun run start (removing --bun) but it took me hours to find it out.
One important side note is that when doing bun run start I am instantly getting following warning while bun --bun run start does not show that warning. Thought it might be related.
(node:97649) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)