Skip to content

Instantly share code, notes, and snippets.

@jasonbyrne
Last active April 27, 2020 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonbyrne/307f573cecb2936a66c935bb0141cb60 to your computer and use it in GitHub Desktop.
Save jasonbyrne/307f573cecb2936a66c935bb0141cb60 to your computer and use it in GitHub Desktop.
Cloudflare Worker to add a header
export async function addCustomHeader(response: Response): Promise<Response> {
const modifiedResponse = new Response(response.body, response);
modifiedResponse.headers.set("X-My-Custom-Header", "Hello there!");
return modifiedResponse;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment