Lessons learned: How not to federate Mastodon

I'm not entirely sure what I want this blog to be yet. For now, it will just be whatever project I'm currently working on.

So I just tried following someone else on Mastodon and noticed that I couldn't follow anyone. Nor could they follow me. Checking in Mastodon Sidekiq reveals the issue:

Mastodon::UnexpectedResponseError: returned code 401

I looked online and found this GitHub issue. Turns out, there's a small wrinkle with setting up LOCAL_DOMAIN and having other things hosted on the same server. It looks like Mastodon servers (and probably other software in the Fediverse) use the the Webfinger protocol to verify that an account exists on the server. However, my domain's Webfinger instance was pointing to my homepage instead!

So all the servers were rejecting my follow requests and interactions as illegitimate. After correctly redirecting the Webfinger endpoint of my main domain (https://ylhuang.com/.well-known/webfinger), I was back online and all my interactions within the Fediverse happened soon after (likes, follows, etc.).

Hopefully, this helps others trying to set up their own Mastodon server.

'Til next time!

Tags: #federation #mastodon #troubleshooting #Fediverse

Questions or suggestions? Reach out to me at vance.ylhuang.com!