Open
Description
Describe the bug
We have an external rewrite (beforeFiles):
{
source: "/client/:path*",
destination: `${CDN_URL}/client/:path*`,
},
It works fine on first invocation, but fails on every subsequent invocation:
"exceptions": [
{
"stack": " at Object.convertTo (worker.js:287862:16)\n at worker.js:287909:40\n at async worker.js:293333:25",
"name": "TypeError",
"message": "Response with null body status (101, 204, 205, or 304) cannot have a body.",
"timestamp": 1748374222550
}
],
I have traced the issue down to Etag, the presence of if-none-match
header will make the subsequent rewrite fail (I guess the status code is 304, and there's no body if Etag matches).
Not sure if it's a Cloudflare issue, opennext issue or something else, as I'm struggling to trace down the stack trace. If anyone else has encountered it, would appreciate any help. We didn't have this issue with next-on-pages at least, with the equivalent rewrites setup.
Steps to reproduce
N/A (
Expected behavior
Rewrites with Etag should work
@opennextjs/cloudflare version
1.0.4
Wrangler version
4.17.0
next info output
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:39 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6020
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 22.15.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.11.0
Relevant Packages:
next: 15.3.2 // Latest available version is detected (15.3.2).
eslint-config-next: 15.3.2
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.3
Next.js Config:
output: N/A
Additional context
No response