Skip to content

Instantly share code, notes, and snippets.

@nanos
Created November 23, 2022 17:57
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 nanos/e5e25ef3b1ea9381250a0f3992f0e225 to your computer and use it in GitHub Desktop.
Save nanos/e5e25ef3b1ea9381250a0f3992f0e225 to your computer and use it in GitHub Desktop.
webfinger through CloudFlare Worker
/**
* 1) Create a worker with the below content, replacing your target account
* 2) Assign that worker to the .well-known/webfinger* route on your domain.
*/
// Change this to yor target account
const account = 'you@instance.social';
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const domain = account.split('@')[1];
return fetch(new Request(`https://${domain}/.well-known/webfinger?resource=acct:${account}`));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment