Skip to content

Instantly share code, notes, and snippets.

@abbaspour
Last active January 22, 2025 03:32
Show Gist options
  • Save abbaspour/4be371d350250ce23881a5bcfd9b45a2 to your computer and use it in GitHub Desktop.
Save abbaspour/4be371d350250ce23881a5bcfd9b45a2 to your computer and use it in GitHub Desktop.
Auth0 Custom Domain Cloudflare Worker
export default {
async fetch(request, env) {
request = new Request(request);
const url = new URL(request.url);
url.hostname = env.AUTH0_EDGE_RECORD;
request.headers.set('cname-api-key', env.CNAME_API_KEY);
const response = await fetch(url, request);
return response;
}
}
[observability.logs]
enabled = true
[vars]
AUTH0_EDGE_RECORD = "xxx.auth0.com"
CNAME_API_KEY = "yyy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment