Skip to content

Commit

Permalink
Remove response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlee85 committed Dec 1, 2023
1 parent 24d8459 commit a56ddaa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/v7-ef-cloud-fetch/edge-functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit a56ddaa

Please sign in to comment.