Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa committed Jan 10, 2025
1 parent 7a1cc48 commit c223f8f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/edge-preview-authenticated-proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,20 @@ async function handleRawHttp(request: Request, url: URL) {
Vary: "Origin",
});

// Pass the raw content type back so that clients can decode the body correctly
const contentType = responseHeaders.get("Content-Type");
if (contentType) {
rawHeaders.set("Content-Type", contentType);
}
const contentEncoding = responseHeaders.get("Content-Encoding");
if (contentEncoding) {
rawHeaders.set("Content-Encoding", contentEncoding);
}
const transferEncoding = responseHeaders.get("Transfer-Encoding");
if (transferEncoding) {
rawHeaders.set("Transfer-Encoding", transferEncoding);
}

// The client needs the raw headers from the worker
// Prefix them with `cf-ew-raw-`, so that response headers from _this_ worker don't interfere
const setCookieHeader = responseHeaders.getSetCookie();
Expand Down

0 comments on commit c223f8f

Please sign in to comment.