Override Nginx media type for a URL

 2 weeks ago
source link: https://akrabat.com/override-nginx-media-type-for-a-url/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Override Nginx media type for a URL

I followed Maarten Balliauw’s article on setting up a pointer to my @[email protected] Mastodon account on my own domain at @[email protected] 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.

This article was posted on 21 November 2022 in Web

About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK