-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
Describe the bug
When using encodeBody: "manual" in Response, OpenNext ignores this option and still applies compression, causing double compression of pre-compressed content.
Steps to reproduce
const res = await env['r2_bucket'].get('file.gzip')
return new NextResponse(res.body, {
headers: {
"content-type": res.httpMetadata.contentType,
"content-encoding": res.httpMetadata.contentEncoding,
},
encodeBody: "manual",
});
Expected behavior
Content should not be re-compressed when encodeBody: "manual" is set.
Actual:
OpenNext compresses the content anyway, corrupting already compressed data from R2/S3.
@opennextjs/cloudflare version
1.9.0
Wrangler version
4.40.2
next info output
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.1.0: Fri Sep 19 19:14:26 PDT 2025; root:xnu-12377.40.77.505.1~4/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 20.11.1
npm: 10.2.4
Yarn: 1.22.22
pnpm: 9.15.0
Relevant Packages:
next: 15.5.4
eslint-config-next: 15.0.1
react: 19.1.1
react-dom: 19.1.1
typescript: 5.8.3
Additional context
No response