From a56ddaa0ed9340a8912872f36ca2a1ea18e00189 Mon Sep 17 00:00:00 2001 From: Tristan Lee Date: Fri, 1 Dec 2023 17:30:40 -0500 Subject: [PATCH] Remove response headers --- examples/v7-ef-cloud-fetch/edge-functions/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/v7-ef-cloud-fetch/edge-functions/index.js b/examples/v7-ef-cloud-fetch/edge-functions/index.js index 9ea06b72a..d72dcb7f4 100644 --- a/examples/v7-ef-cloud-fetch/edge-functions/index.js +++ b/examples/v7-ef-cloud-fetch/edge-functions/index.js @@ -5,6 +5,15 @@ export async function handleHttpRequest(request) { ? await request.arrayBuffer() : undefined; + // Remove headers that could cause the a response status of 204/304 to be returned. + const headersToRemove = [ + 'etag', + 'if-modified-since', + 'if-none-match', + 'last-modified', + ]; + headersToRemove.forEach((header) => request.headers.delete(header)); + // Perform a fetch request to the original request URL with the same method, headers, and body. // Specify 'edgio_serverless' as the origin to fetch the original Cloud Functions response. const cloudFunctionsResponse = await fetch(request.url, {