Webfinger Serving on Jekyll for Mastodon Discovery

Scott wrote today on his blog about user discovery in Mastodon using the webfinger protocol. I’ve considered running my own Mastodon server because it would be nice to link my presence there directly to my permanent public domain. That seems like a big commit right now given the explosive growth of Mastodon. Too many unknowns: costs, time to administer, security, etc.

This webfinger concept should allow me to host my Mastodon identity right here on my static blog. As we say in the field of computer science: most interesting problems come down to coming up with good names and adding one more level of indirection. This solution falls into the latter category.

Surprisingly, hosting a static JSON file without a .json extension isn’t trivial. I followed this advice from Domenico Luciani to get this URL to properly serve up from my site:

https://chrisbrooks.org/.well-known/webfinger

The key issue with this approach is that the content type served is application/octet-stream rather than application/json. Still it seems, in the spirit of “clients should be tolerant”, it still works. If I search now for @chris@chrisbrooks.org in my Mastodon client, it finds me over on techhub.social. It appears that you have to be logged in to your local server instance in order for this user search to work properly.

Updated: