Last active
April 12, 2022 06:48
-
-
Save aidansteele/74f3f7d7ff8015391752ad29ba567b39 to your computer and use it in GitHub Desktop.
example of using a cloudflare worker (for custom domains) in front of a lambda fURL
This file contains hidden or 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
const furlDomain = "lf4rhhulpamois3oz5z4i3anpe0loidx.lambda-url.us-east-2.on.aws"; | |
async function handleRequest(request) { | |
const url = new URL(request.url); | |
url.hostname = furlDomain; | |
const newRequest = new Request(url, request); | |
newRequest.headers.set('Host', furlDomain); | |
return await fetch(newRequest); | |
} | |
addEventListener("fetch", event => { | |
event.respondWith(handleRequest(event.request)) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment