{"id":15859547,"url":"https://github.com/pstadler/cloudflare-webfinger","last_synced_at":"2026-02-26T22:04:16.098Z","repository":{"id":140781741,"uuid":"600002690","full_name":"pstadler/cloudflare-webfinger","owner":"pstadler","description":"Bring your own domain to Mastodon using Cloudflare Workers.","archived":false,"fork":false,"pushed_at":"2023-02-13T11:02:40.000Z","size":15,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-13T23:40:01.425Z","etag":null,"topics":["cloudflare","cloudflare-workers","mastodon","webfinger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pstadler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-10T11:11:19.000Z","updated_at":"2026-02-09T04:18:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7ed0f54-9155-4221-bd37-2474259c2f50","html_url":"https://github.com/pstadler/cloudflare-webfinger","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"e211cc91a58e856c86b77aea1ffd21e5bb3d8b12"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pstadler/cloudflare-webfinger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstadler%2Fcloudflare-webfinger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstadler%2Fcloudflare-webfinger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstadler%2Fcloudflare-webfinger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstadler%2Fcloudflare-webfinger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pstadler","download_url":"https://codeload.github.com/pstadler/cloudflare-webfinger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstadler%2Fcloudflare-webfinger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29874502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T21:05:00.265Z","status":"ssl_error","status_checked_at":"2026-02-26T20:57:13.669Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","cloudflare-workers","mastodon","webfinger"],"created_at":"2024-10-05T21:21:28.136Z","updated_at":"2026-02-26T22:04:16.080Z","avatar_url":"https://github.com/pstadler.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom Mastodon domain using Cloudflare Workers\n\n\u003e Use your own domain as an alias of your Mastodon handle.\n\nWhen presented with a string like `ps@infosec.exchange`, Mastodon clients use the WebFinger protocol to retrieve a JSON document pointing to resources related to this account.\nWe can make use of this by proxying requests to our own custom domain at `/.well-known/webfinger` to the actual Mastodon instance using Cloudflare Workers.\n\n```mermaid\nsequenceDiagram\n  actor C as Client\n  participant W as Cloudflare Worker\n  participant M as Mastodon Instance\n\n  C-\u003e\u003e+W: GET https://pstadler.dev/.well-known/webfinger\u003cbr\u003e?resource=acct:ps@pstadler.dev\n  Note over W: Find target for alias in mapping:\u003cbr\u003eps@pstadler.dev → ps@infosec.exchange\n  W-\u003e\u003e+M: GET https://infosec.exchange/.well-known/webfinger\u003cbr\u003e?resource=acct:ps@infosec.exchange\n  M--\u003e\u003e-W: Response for ps@infosec.exchange\n  W--\u003e\u003e-C: Response for ps@infosec.exchange\n```\n\n## Configuration\n\nConfigure your aliases at the top of `webfinger.js`. Multiple entries are supported.\n\n```js\nconst MAPPING = new Map([\n  ['ps@pstadler.dev', 'ps@infosec.exchange'],\n  ['foo@pstadler.dev', 'bar@example.org']\n])\n```\n\n## Testing\n\nYou can test this worker locally using [miniflare](https://miniflare.dev/).\n\n```sh\n$ npm install\n$ npm run dev\n\n$ curl http://127.0.0.1:8787\\?resource\\=acct:ps@pstadler.dev\n{\"subject\":\"acct:ps@infosec.exchange\",\"aliases\":[\"https://infosec.exchange/@ps\",\"https://infosec.exchange/users/ps\"],\"links\":[{\"rel\":\"http://webfinger.net/rel/profile-page\",\"type\":\"text/html\",\"href\":\"https://infosec.exchange/@ps\"},{\"rel\":\"self\",\"type\":\"application/activity+json\",\"href\":\"https://infosec.exchange/users/ps\"},{\"rel\":\"http://ostatus.org/schema/1.0/subscribe\",\"template\":\"https://infosec.exchange/authorize_interaction?uri={uri}\"}]}\n```\n\n## Deployment\n\nChange values in `wrangler.toml` according to your needs.\n\n```sh\n# Either make sure `wrangler` is available on your system, or run\n# `npm install` and add `./node_modules/.bin` to your PATH variable.\n$ wrangler login\n$ wrangler publish\n\n$ curl https://pstadler.dev/.well-known/webfinger\\?resource\\=acct:ps@pstadler.dev\n{\"subject\":\"acct:ps@infosec.exchange\",\"aliases\":[\"https://infosec.exchange/@ps\",\"https://infosec.exchange/users/ps\"],\"links\":[{\"rel\":\"http://webfinger.net/rel/profile-page\",\"type\":\"text/html\",\"href\":\"https://infosec.exchange/@ps\"},{\"rel\":\"self\",\"type\":\"application/activity+json\",\"href\":\"https://infosec.exchange/users/ps\"},{\"rel\":\"http://ostatus.org/schema/1.0/subscribe\",\"template\":\"https://infosec.exchange/authorize_interaction?uri={uri}\"}]}\n```\n\n## Caveats\n\nAs of early 2023, some native Mastodon clients don't seem to make use of WebFinger when searching for users, which will result in your profile not being found with this approach.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpstadler%2Fcloudflare-webfinger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpstadler%2Fcloudflare-webfinger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpstadler%2Fcloudflare-webfinger/lists"}