Created
April 27, 2020 13:26
-
-
Save jasonbyrne/35ab22815c00e7920afbf3ce0d44fcf4 to your computer and use it in GitHub Desktop.
Add custom header at edge that works on StackPath and Cloudflare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function addCustomHeader(response: Response): Promise<Response> { | |
const modifiedResponse = new Response(await response.arrayBuffer(), 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