Skip to content

Instantly share code, notes, and snippets.

@jed
Last active November 19, 2022 20:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jed/bee2931a3a3e0c548833210211bd4efa to your computer and use it in GitHub Desktop.
Save jed/bee2931a3a3e0c548833210211bd4efa to your computer and use it in GitHub Desktop.
Making your Mastodon account discoverable from your domain, using Cloudflare page rules

Making your Mastodon account discoverable from your own domain, using Cloudflare page rules

Are you (1) moving to Mastodon, but (2) want to use your own Cloudflare-hosted domain for discoverability, and (3) don't want the hassle of managing your own instance?

Well, here's a quick way to make sure that folks can find you when they search Mastodon with your domain. The UX is like this:

image

(If you're not on Cloudflare or would rather just host a file, use Maarten Balliauw's post, How to discover Mastodon account via custom domain, from which this technique was inspired.)

Steps

  1. Go to the Cloudflare dashboard at https://dash.cloudflare.com, then
  2. click on the domain you want to use, then
  3. click Rules in the left sidebar, then
  4. click Create Page Rule, then
  5. for the URL, enter {domain-name}/.well-known/webfinger* (for me it's jed.is/.well-known/webfinger*), then
  6. for the setting, choose Forwarding URL, then
  7. for the status code, choose 302 - Temporary Redirect, then
  8. for the destination URL, enter https://{mastodon-domain}/.well-known/webfinger?resource=acct:{username}@{mastodon-domain} (for me it's https://mastodon.social/.well-known/webfinger?resource=acct:jed@mastodon.social).

Once you're done the screen should like like this, at which point you click Save and Deploy Page Rule to make it official.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment