@decocms/start 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sdk/workerEntry.ts +6 -6
package/package.json
CHANGED
package/src/sdk/workerEntry.ts
CHANGED
|
@@ -1034,9 +1034,7 @@ export function createDecoWorkerEntry(
|
|
|
1034
1034
|
|
|
1035
1035
|
// Logged-in users always bypass — personalized content must not leak
|
|
1036
1036
|
if (sfnSegment?.loggedIn) {
|
|
1037
|
-
const
|
|
1038
|
-
const originReq = new Request(request, { body, method: "POST" });
|
|
1039
|
-
const origin = await serverEntry.fetch(originReq, env, ctx);
|
|
1037
|
+
const origin = await serverEntry.fetch(request, env, ctx);
|
|
1040
1038
|
const resp = new Response(origin.body, origin);
|
|
1041
1039
|
resp.headers.set("Cache-Control", "private, no-cache, no-store, must-revalidate");
|
|
1042
1040
|
resp.headers.set("X-Cache", "BYPASS");
|
|
@@ -1044,7 +1042,10 @@ export function createDecoWorkerEntry(
|
|
|
1044
1042
|
return resp;
|
|
1045
1043
|
}
|
|
1046
1044
|
|
|
1047
|
-
//
|
|
1045
|
+
// Clone request before consuming body — the clone goes to origin
|
|
1046
|
+
// untouched so TanStack Start internals (cookie passthrough, etc.)
|
|
1047
|
+
// work correctly. We only read the body for the cache key hash.
|
|
1048
|
+
const originClone = request.clone();
|
|
1048
1049
|
const body = await request.text();
|
|
1049
1050
|
const bodyHash = await hashText(body);
|
|
1050
1051
|
|
|
@@ -1134,8 +1135,7 @@ export function createDecoWorkerEntry(
|
|
|
1134
1135
|
}
|
|
1135
1136
|
|
|
1136
1137
|
// Cache MISS — fetch origin with the body we already read
|
|
1137
|
-
const
|
|
1138
|
-
const origin = await serverEntry.fetch(originReq, env, ctx);
|
|
1138
|
+
const origin = await serverEntry.fetch(originClone, env, ctx);
|
|
1139
1139
|
|
|
1140
1140
|
// Only cache responses explicitly marked as cacheable by the handler
|
|
1141
1141
|
// (loadDeferredSection sets X-Deco-Cacheable: true). Checkout actions,
|