Skip to content

Commit fdfa5af

Browse files
authored
fix skew protection handling of POST requests (#810)
1 parent 7d18a58 commit fdfa5af

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/wet-peaches-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
fix skew protection handling of POST requests

packages/cloudflare/src/cli/templates/skew-protection.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ export function maybeGetSkewProtectionResponse(request: Request): Promise<Respon
6262
url.hostname = hostname;
6363
const requestToOlderDeployment = new Request(url!, request);
6464

65-
return fetch(requestToOlderDeployment);
65+
// Remove the origin header to prevent an error with POST requests
66+
const headers = new Headers(request.headers);
67+
headers.delete("origin");
68+
69+
return fetch(requestToOlderDeployment, { headers });
6670
}
6771
}
6872

0 commit comments

Comments
 (0)