Adding Mastodon discoverability by e-mail address

Through the “interesting” days, when people started migrating into Mastodon, I found quite interesting toot from one of its users where he mention adding Mastodon discoverability for any domain using WebFinger Protocol.

I have been quite interested in how to implement this on my end, as I prefer people to discover me with my long-standing email address, rather than the newly created username on the selected mastodon server.

As my website is hosted on Netlify I decided to check if I can implement this. Here is how it goes.


For a better understanding of how Scott achieved this on his end, I referred to his original post1. I read some more information about WebFinger Protocol on Wikipedia and then recalled John Mueller post from not soo far back, where I found a conclusive solution for me.


Before starting I need to explain a couple of things.

As mentioned at the beginning, I would like for people in the Mastodon network to be able to discover me by my email address rather than a specific username in the Mastodon network (currently @dariusz_w@seocommunity.social).

I am not using my main domain for my website. My site is served in the subdomain dariusz of the domain wieckiewicz.org. Putting an @ symbol between resolving my email address.

Mastodon uses WebFinger Protocol to discover users.

When using tools like Lookup WebFinger located in the top-right part of WebFinger website, you can type an email address to find how this resolves.

As you will see at the start, Lookup WebFinger will look into a domain, that is part of your email, as follow:

GET https://wieckiewicz.org/.well-known/webfinger?resource=acct%3Adariusz%40wieckiewicz.org

As my website is static using Hugo I don’t have real server functionality to add dynamic responses. To point out this dynamic request for WebFinger I decided to utilise, what John mention in his Apache & co part – redirects.

Redirects #

I already got some redirects in place for my main domain. If you type wieckiewicz.org in your browser address bar you will be 301 redirected to dariusz.wieckiewicz.org. I am doing this with _redirects file located in my /static folder of my Hugo-based website.

https://wieckiewicz.org https://dariusz.wieckiewicz.org 301!
https://wieckiewicz.org/* https://dariusz.wieckiewicz.org/:splat                      301!

These two rules will not only redirect the main domain but all links, where the subdomain dariusz. is missing in the URL.

The original request sent by WebFinger looks as follows:

https://wieckiewicz.org/.well-known/webfinger?resource=acct:dariusz@wieckiewicz.org

As you noticed, symbols like : and @ are replaced by Unicode equivalents for compatibility reasons.

That same matter we need to have in our mind when we will compose a redirect rule in our _redirects file, so nothing will unintentionally break.

Theoretically reference to .well-known/webfinger shall be enough, but some sourced, including John, referring also to Web Host Metadata (.well-known/host-meta) and Node Info (.well-known/nodeinfo), so I will keep them as well.

Between the two rules mentioned above, I pasted the following:

https://wieckiewicz.org/.well-known/webfinger?resource=acct%3Adariusz%40wieckiewicz.org         https://seocommunity.social/.well-known/webfinger?resource=acct%3Adariusz_w%40seocommunity.social     301!

https://wieckiewicz.org/.well-known/host-meta?resource=acct%3Adariusz%40wieckiewicz.org         https://seocommunity.social/.well-known/host-meta?resource=acct%3Adariusz_w%40seocommunity.social     301!

https://wieckiewicz.org/.well-known/nodeinfo?resource=acct%3Adariusz%40wieckiewicz.org          https://seocommunity.social/.well-known/nodeinfo?resource=acct%3Adariusz_w%40seocommunity.social     301!

This may look a bit complicated, but if you got more users in your domain, and these users may use different servers in the fediverse, it will be easier to add them and not restrict them to one instance (server).

Here you will see, where WebFinger is requesting a response on .well-known/webfinger?resource=acct:dariusz@wieckiewicz.org in my domain, will be pointed to seocommunity.social and my username there dariusz_w@seocommunity.social

Once the redirect is active, WebFinger Lookup service shall return the response for the right user on seocommunity.social server.

Remember, before you apply any _redirects in production check them on Netlify’s Playground!

It’s time to check if other users can search for us (find us) in the Mastodon network using our original e-mail address without knowing where exactly, on which server, we have created our account.

Searching user by email address in Mastodon App

This will give us the flexibility to move between instances and people, who do not follow us, can still find us using our original email address. Of course, as long as we will keep our redirect rules up-to-date.

Why not you try, find me and say hello!

Comments