A bit of Mastodon fun: I can now be simultaneously found via the alias "@ [email protected]".

That username is entirely interchangeable with my real @ [email protected] username. You can mention it and I will receive the mention, and you can search for it to find my account.

Here's a mention using the alias: @alex.

And here's one using the real username: @alex.

In practice, these appear identical! The Webfinger protocol is cool. (You don't need to self host to do this.)

If you own your own domain and want to be accessible on Mastodon via @[email protected], but you don't want to bother with self hosting, it's pretty easy to set up.

On your Mastodon instance, navigate to `/.well-known/webfinger?resource=acct:[email protected]`. Copy the JSON response.

On your website, add a JSON response at `/.well-known/webfinger` and send the JSON from Mastodon.

That's it! Search for your alias username on Mastodon and your real account should show up.

Some things to note:

- When looking up your webfinger on Mastodon, make sure not to include the preceding '@' in your account name.

- Technically this method will make you available at *any* [email protected]. If you need multiple specific aliases pointing at different accounts, your setup will be a bit more complex. You'll need to take in the `?resource=` URL param and return a webfinger per account.

For single user websites though, the easy works fine.

@alex thanks for sharing, I’ll have to give this a go. I quite like the idea of being [email protected] rather than [email protected]
@alex Any idea if this works with GitHub Pages? I have my site there and my domain is CNAMEd to there.

@kylewritescode Hmmm, I haven’t used GH Pages myself so I’m not sure. If they allow you to serve dot-prefixed directories then it might just work, but if they restrict that then it may not be possible without adding a proxy between your DNS provider and GH Pages.

I added some details here too: https://mastodon.macstories.net/@alex/109836799567042081

Alex Guyot (@[email protected])

@[email protected] Yeah it just needs to be a text file that gets served from that url. Must be at `/.well-known/webfinger`, with no file extension. How you achieve that varies wildly by host which is why I didn’t elaborate further. Some hosts won’t serve content in paths with dot directories, so you might need to work around that at the web server level. Ideally you can just add a no-extension file named “webfinger” with the JSON text inside a top-level “.well-known” directory and it will work, but ymmv.

Mastodon

@kylewritescode @alex sorry to turn this into an IT ticket but I just tried this with GitHub pages and it didn't work :(

It's such a bummer because I was hoping to get a vanity URL without spinning up a new instance and losing all of my posts, faves, etc.

Just in case I'm doing something wrong, here's the file itself on GitHub:

https://github.com/alabut/alabut.github.io/blob/master/.well-known/webfinger

And both domains that should point to it but come up 404:

https://alabut.com/.well-known/webfinger

https://alabut.github.io/.well-known/webfinger

alabut.github.io/webfinger at master · alabut/alabut.github.io

My alabut.com portfolio site. Contribute to alabut/alabut.github.io development by creating an account on GitHub.

GitHub
@alabut @kylewritescode I haven’t used that setup myself, but try this: https://github.com/tschaub/gh-pages/issues/381
How to add .well-known directory? · Issue #381 · tschaub/gh-pages

I've uploaded a .well-known folder to my master branch, but when deploying the project using gh-pages the folder doesn't show up. This is my config. ghpages.publish('dist', { dest: 'myProject-pwa',...

GitHub
@alex @kylewritescode oh thank you, I’ll try that shortly!!!
@alex @kylewritescode oh that’s weird - it worked but only partially? It comes up when I search for anything ending in my alabut.com domain on my current instance (techhub.social) but comes up empty when searching from other instances unless I use my full @alabut handle.
@alabut @kylewritescode Works for me when searching from the MacStories instance.

@alex @kylewritescode that’s so weird that I can’t seem to replicate that on your instance either. I thought maybe it was a propagation thing but I still end up having to use the original handle to get a search result.

Judging from your desktop screenshot, maybe it’s a mobile thing?

@alabut @alex Following up on this late. 😀 Looks like y’all have this partially working. I will try this later today and see what I can get on my GH page. Thx 🙏🏼
@kylewritescode @alabut Okay I did some more testing on this. From what I can tell, it will only work if you are *signed into the instance that you're searching from.* If you search on an instance where you're signed out, it doesn't show up. I tested using a couple test accounts I have on different instances. (Even if you sign out on your own instance you can see that it no longer shows up.)

@kylewritescode @alabut I assume it doesn't cache the alias since the account is a different username, and you can only do a non-cached search if you're logged in.

Seems like not a big deal overall since most people will be signed in when they're looking up users.

@alex @kylewritescode oh ok, that makes sense. So it’s sort of like a fun secret handshake for existing Mastodon users 😆 😎

Thanks for looking into this and debugging it!

@alex I did this with some .htaccess redirect rules to match on specific accounts only https://gist.github.com/dotsam/2f56a9618b513f65cf4956efac982ac1
Mastodon Webfinger Redirect/Alias

Mastodon Webfinger Redirect/Alias. GitHub Gist: instantly share code, notes, and snippets.

Gist
@samedwards @alex did the same thing with Cloudflare workers, because my domain DNS was already with Cloudflare anyway - https://github.com/dvcrn/mastodon-alias-cloudflare
GitHub - dvcrn/mastodon-alias-cloudflare: Cloudflare worker to add a search alias for your custom domain to mastodon

Cloudflare worker to add a search alias for your custom domain to mastodon - GitHub - dvcrn/mastodon-alias-cloudflare: Cloudflare worker to add a search alias for your custom domain to mastodon

GitHub
@alex One weird little gotcha - some browsers automatically pretty-print the JSON, so if you just copy the text, it will be malformed. The intersection of "own your own domain" and "won't recognize that problem when it occurs" is likely pretty small, but figured I'd mention.
@alex Done and done, I'm @jef now. Thanks!

@tantramar I’m embarrassed to say I remember “finger” but have no flippin clue what Alex is saying.

@alex @viticci

@alex This is the best tip of the day dude! I published a quick TIL-like post about it and of course full credit goes to you Alex!

https://pawelgrzybek.com/use-your-domain-for-the-mastodon-account-without-hosting-an-instance/

Use your domain for the Mastodon account without hosting an instance | pawelgrzybek.com

Here is a simple trick to access your Mastodon profile using your own domain without hosting your own instance.

pawelgrzybek.com
@alex thanks for this magic Alex! Enable in less than 2mn @c3dric

@alex looks like @ivory does not support yet this search feature yet.

@mark I should find my account "@ c3dric @mastodon.social" when searching for "@ c3dric @ paparasitic.com". That works with other clients. Thanks (v1.1 - 10205)

@c3dric @alex @mark Can't imagine this is a high priority (wouldn't even be at the top of *my* feature request list) but confirm that I can successfully find my @belchingdragon.com alias searching in Ice Cube but not @ivory (yet).
@Hendel Are you using the "find users with..." button in search and not the search button in the keyboard? The search button from the keyboard only finds posts.
@ivory Yes, “find users with” for @ hendel @ belchingdragon.com fails. “go to user" for the same value goes to an empty profile with 0 follows/following. Using the current Mac beta, BTW.
@Hendel Are you copying the name in or typing manually? Seems like we have some issue when copying, but works fine when typing it in.
@ivory Typing - same results for both "users with" and "go to user" on IOS 1.1.
@alex Very cool! Only took a few minutes to get this up and running with @cloudflare workers. This makes it very simple and serverless!
@alex interesting, I did it and it works. For me it's a feature that the name portion doesn't matter.
@alex So this is only for searches or telling people my elephant address, can't have the alias actually displayed as my address on posts or anything, right?
@Hendel Correct. The alias isn’t your actual username, so while people can find you/@mention you by using it, your actual account username will still show up everywhere unless you host your own instance.