Juha-Matti Santala
Community Builder. Dreamer. Adventurer.

Hard to spot auto-format error with Prettier, Netlify redirects and Mastodon webfinger

2.5 years ago when I joined Mastodon, I set up a redirect so that people could refer to me in Fediverse with my domain (@hamatti@hamatti.org) even though I didn’t have such instance. This can be achieved with a webfinger redirect:

/.well-known/webfinger/* https://{your_mastodon_domain}/.well-known/    webfinger?resource=acct:{your_account}@{your_mastodon_domain} 301

This has enabled me to keep using the domain-specific version in all my materials like slides for my talks and workshops and not worry about potentially switching an instance in the future.

Every now and then, people would tell me it doesn’t work though.

What happened, is that every time I added a new redirect into my _redirects and saved the file, VS Code’s Prettier plugin ran and escaped the * in the address, rendering the pattern incorrect.

+ /.well-known/webfinger/\* https://mastodon.world/.well-known/webfinger?resource=acct:hamatti@mastodon.world 301
- /.well-known/webfinger/* https://mastodon.world/.well-known/webfinger?resource=acct:hamatti@mastodon.world 301

Since I didn’t use this redirect myself pretty much ever and I was focused on only testing the new redirect I had added, it went unnoticed until someone told me they couldn’t find me.

The last time it happened, I realised why it was happening and added a .prettierignore file to my project root with

_redirects

and now I can create new redirects without a worry!


If something above resonated with you, let's start a discussion about it! Email me at juhamattisantala at gmail dot com and share your thoughts. In 2025, I want to have more deeper discussions with people from around the world and I'd love if you'd be part of that.