Pragmatism in the real world

Override Nginx media type for a URL

I followed Maarten Balliauw’s article on setting up a pointer to my @akrabat@phpc.social Mastodon account on my own domain at @rob@akrabat.com. I’m not sure how useful it is and would prefer to have my own domain as the main account. Something to think about at least.

When setting up https://akrabat.com/.well-known/webfinger, I realised that it was being served with a Content-Type of application/octet-stream, when it should be application/json.

To fix this, I added this to my Nginx config:

# .well-known/webfinger is a JSON file
location ~ /\.well-known/webfinger {
    types { } default_type "application/json";
}

Now, it works as expected.

One thought on “Override Nginx media type for a URL

Comments are closed.