Skip to content

Commit 14b8182

Browse files
authored
fix(cloudflare): PPR in wrangler dev (#718)
1 parent 843497b commit 14b8182

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/lucky-actors-flash.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@opennextjs/aws": patch
3+
---
4+
5+
fix(cloudflare): PPR in wrangler dev
6+
7+
PPR works fine when deployed but not in dev because of bug in miniflare.
8+
Adding a workaround until the bug is fixed upstream.

packages/open-next/src/overrides/wrappers/cloudflare-node.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ const handler: WrapperHandler<InternalEvent, InternalResult> =
5353
responseHeaders.append("Set-Cookie", cookie);
5454
}
5555

56+
// TODO(vicb): this is a workaround to make PPR work with `wrangler dev`
57+
// See https://github.com/cloudflare/workers-sdk/issues/8004
58+
if (url.hostname === "localhost") {
59+
responseHeaders.set("Content-Encoding", "identity");
60+
}
61+
5662
const { readable, writable } = new TransformStream({
5763
transform(chunk, controller) {
5864
controller.enqueue(Uint8Array.from(chunk.chunk ?? chunk));

0 commit comments

Comments
 (0)